Prev: Killing a process spawn off by ssh
Next: icmp socket
From: tejal.acharya@gmail.com on 31 Jan 2006 10:00 Hey I am new to the group..and to korn scripting....I have a script that starts a process....i want to periodically check the status of my process and output to the screen ' I am running' How would i do that... Tejal
From: Stephan Brönnimann on 31 Jan 2006 10:23 tejal.acharya(a)gmail.com wrote: > Hey I am new to the group..and to korn scripting....I have a script > that starts a process....i want to periodically check the status of my > process and output to the screen ' I am running' > > How would i do that... > Tejal Send the process to the background and use $! to see if the process still exists: #! /bin/sh cmd="echo start; sleep 3; echo done" chktime=1 (eval $cmd)& pid=$! while ps -p $pid >/dev/null 2>&1 do echo "'$cmd' running" sleep $chktime done Stephan
|
Pages: 1 Prev: Killing a process spawn off by ssh Next: icmp socket |