![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| not showing restore information while run script | happyv | Shell Programming and Scripting | 1 | 11-20-2007 01:05 AM |
| executing script | big123456 | Shell Programming and Scripting | 1 | 06-03-2005 04:32 AM |
| RSH use for executing a script | frustrated1 | Shell Programming and Scripting | 6 | 10-02-2003 05:24 AM |
| Executing ksh script from cgi | hodges | Shell Programming and Scripting | 1 | 05-27-2003 07:57 AM |
| Executing Ps in script | Claude | Shell Programming and Scripting | 1 | 11-21-2001 11:01 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
executing script not showing up in ps -efx
Hi everyone, here's my problem. I have a script that runs in a infinite loop, repeating the same action in another script every 10 minutes. We need to monitor whether or not this loop script is running and be able to kill it should the need arise. However, the name of the script does not show up in the ps -efx listing, even though it is clearly running in the other window. Is there a way to make the script show itself in the ps -efx output, or get it's process ID?
Thanks! |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
if you know the pathname to your script....
fuser /path2yourScript man fuser |
|
#3
|
||||
|
||||
|
Quote:
Code:
echo $$ > /tmp/script.PID |
|
#4
|
|||
|
|||
|
hi
i am facing the same proble came u suggest me how to read it from a file once u read it and send it to a file
|
|
#5
|
|||
|
|||
|
Quote:
Code:
pid=`cat /tmp/script.PID` But if your system's ps command supports formatted output, with the -o swtich, you can use that instead of saving the PID in a temp file. Try ps -eo pid,args, and search the outpout to see if the name of your script shows up. The importnat thing here is using the args format (as an argument to the -o option). By default, ps outputs the command name as the comm format, which is a shortened form of the command that the system actually executes; the args format gives the full form of the command, which will include the name of the script. Last edited by hadarot; 09-10-2005 at 10:34 AM. |
|
#6
|
|||
|
|||
|
thanks ...this willwork
but do we have asolution to this without the write read operation from a file How do we make ps command display the scriptname that is running ? wh does it show .sh and not complete scripname.sh. if the scripname was there we could have found it by simple ps and grep. someone in the group suggested the reason for not didplaying scripting name coud be that #!bash is not inlude in the running script / any solution that way |
|
#7
|
||||
|
||||
|
I would not suggest building a solution that involves a script running an infinite loop. Why not loop until a "stop" file is found, e.g...
Code:
until [[ -f /tmp/stopfile ]] do : sleep 600 done rm /tmp/stopfile Code:
touch /tmp/stopfile |
||||
| Google The UNIX and Linux Forums |