loops - While process is not running, do something -


while ps aux | grep '[/]pathtoprocess' echo running done echo process finished 

i use shell script keep running while process running. same while process not running.

how go it? in advance

x=$(ps aux | grep '[/]pathtoprocess')  while false echo not running done 

==========================================================================

new script

#!/bin/ksh  if ps -aux | grep "[/]$1"     echo "running" else     echo "not running"     #do stuff     # can add while loop here      #echo "process finished fi 

output:

./icheck.sh xyz not running  ./icheck.sh usr/bin/cron running 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -