Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-13-2002, 11:58 AM   #1
Registered: Jul 2002
Posts: 38

Rep: Reputation: 15
Question Script Please

I am hoping someone can help me out. I want a script that checks to see if a certain process is running. If the process in questions isn't running the script would then start the process and go to sleep for 30 seconds. When 30 seconds has expired the script would then repeat the process. The script should run the entire time the server is running.

Please help!!!!
Old 11-13-2002, 12:05 PM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 245Reputation: 245Reputation: 245
And have you tried to write one yourself ? What was the outcome ? Do you know how to write scripts ? Maybe you should search on a free scripts site, maybe get some ideas that way.

I don't mean to sound rude, but it doesn't sound like you even attempted to look into this yourself. You know what you want, why not search resources to accomplish this ? Are we only here because you don't want to do it yourself or even attempt it ??
Old 11-13-2002, 12:36 PM   #3
Registered: Jul 2002
Location: Santa Cruz, CA
Distribution: lfs
Posts: 538

Rep: Reputation: 30
to check if the script is running:

if [ -z $(ps -a | grep <prog>) ]; then
do what you want

# this will check if the prog is running, and do what you want if it's not.

Then you're going to need to add some "wait"'s and loops in there.

check here:

and here's a reference on test operators:
Old 11-13-2002, 01:22 PM   #4
LQ Addict
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
Originally posted by adam_boz
Then you're going to need to add some "wait"'s and loops in there.
Have you ever heard of cron?
Old 11-13-2002, 06:34 PM   #5
Registered: Jul 2002
Location: Santa Cruz, CA
Distribution: lfs
Posts: 538

Rep: Reputation: 30
hehe... yeah, but I think the teacher wants it in the script ;-)


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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Iptables (with masq) troubleshooting, very simple script attached script and logs. xinu Linux - Networking 13 11-01-2007 04:19 AM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 10:23 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 04:21 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:00 AM.

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