|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
Pls see the following code where i am trying to
check if a unix script is running or not. 1. check.ksh ------------------ #!/bin/ksh if ps -ef | grep "myscript.ksh" >/dev/null then echo "my script running" else echo "my script not running" fi ------------------- Above, check.ksh checks to see if "myscript.ksh" is running or not. i can see that it works when the "myscript.ksh" is NOT RUNNING. i run my "myscript.ksh" and it executes successfully. Now when i run "check.ksh", it still shows that "myscript.ksh" is RUNNING, while in fact "myscript.ksh" is stopped alltogether. Any answers pls as to y this is happening. i have tried to see by myself if "myscript.ksh" is running even after it exceuted successfully by typing: $ ps -ef | grep "myscript.ksh" output: loginid 22232 9841 0 12:52:15 pts/1 0:00 grep myscript.ksh |
|
#2
|
|||
|
|||
|
change:
ps -ef | grep "myscript.ksh" >/dev/null to: ps -ef | grep "myscript.ksh" | grep -v grep >/dev/null It is seeing its' own grep process. The 'grep -v' pipe will ignore anything with grep in it. |
|
#3
|
|||
|
|||
|
hi faulkner
thanks a bunch. The script is working now. Appreciate ur quick and solid help thnx ![]() |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > how can i check if a unix script is already running |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|