LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 11-01-2006, 12:36 AM   #1
rickenbacherus
Member
 
Registered: Mar 2003
Location: colorado springs. colorado
Distribution: Debian-Sid 2.6.24-rt1
Posts: 290

Rep: Reputation: 30
Need simple bash script help


I need ivman to run once as user 'ivman' on boot (no problem) and once as $USER on login so a test is required for an already running ivman as $USER. In case you log out and then back in we do not want 2 instances of ivman running as $USER

I'm getting closer but still no workie. Any help would be great. Ultimately the script would test for $CURRENTLY_LOGGED_IN_USER but it's not critical. I can figure that out later. Thanks.

Code:
#!/bin/sh

IVMAN=`which ivman`
id=`pgrep -U glenn ivman`

if [ '$id' -eq '0' ]

then
  $IVMAN
 else
 exit
fi
 
Old 11-01-2006, 02:44 AM   #2
cdhgee
Member
 
Registered: Oct 2003
Location: St Paul, MN
Distribution: Fedora 8, Fedora 9
Posts: 513

Rep: Reputation: 30
How about something like the following instead of your pgrep line:

Code:
ps -ef | grep ivman | grep $USER | cut -f3
Adjusting -f3 to the appropriate field where necessary (I can't remember the PID field number off the top of my head).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple bash script lp449 Linux - Networking 3 08-02-2005 04:25 PM
Simple bash script Soulful93 Programming 1 06-04-2005 07:26 PM
Simple Bash Script dmedici Programming 9 12-31-2004 03:48 AM
Help with simple bash script - please tw001_tw Linux - Software 5 12-19-2004 09:02 PM
Simple BASH script fio Linux - General 5 01-18-2003 03:26 PM


All times are GMT -5. The time now is 06:13 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration