![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to log start/stop time of ALL processes | bluesky099 | UNIX for Advanced & Expert Users | 10 | 12-18-2007 12:01 AM |
| Start Stop Apache | MILLERJ62 | AIX | 2 | 12-27-2005 05:40 PM |
| Help: how to start/stop FTP server in solaris? | eddsos | SUN Solaris | 1 | 08-07-2005 01:32 PM |
| Stop/Start proftpd | Lomic | UNIX for Dummies Questions & Answers | 1 | 12-09-2004 09:38 AM |
| Start/Stop Script | jjv1 | UNIX for Dummies Questions & Answers | 2 | 12-16-2003 04:28 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Checking before start and stop processes
Hi,
I have 2 start and stop sh. Start sh -------- This will start few processes. Example code: echo "start process : lgz200 /pipe=test_jobs" nohup lgz200 /db=test/test1@test1 /pipe=test_jobs > ../log/lgz200_j.log & echo "echo \"stop process (pid=$!): lgz200 /pipe=test_jobs\"" >> test_stop echo "kill -9 $!" >> test_stop echo "start process : lgz210 /pipe=test_jobs" nohup lgz210 /db=test/test1@test1 > ../log/lgz210.log & echo "echo \"stop process (pid=$!): lgz210 /pipe=test_jobs\"" >> test_stop echo "kill -9 $!" >> test_stop chmod 744 test_stop exit 0 test_stop script (auto generated from start script) -------------- echo "stop process (pid=155164): lgz200 /pipe=test_jobs" kill -9 155164 echo "stop process (pid=128078): lgz210 /pipe=test_jobs" kill -9 128078 Problem ------- I wish to include checking in start and stop script like: start - check if the process name is exist, if exist no action. else start a new process. stop - a loop to check if the process still exists, if exist, kill it. this 2 checking is to make sure there are no duplicate process that will be run concurently from start script and to make sure we will completely kill the process in stop script. I am still beginner in unix, can anyone help me to show me some sample code to do the 2 checkings? Any other suggestion will be most welcomed. Thank you very much for your help. Regards, weihann. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|