Question about using pid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You might consider using pidof to get the process id of the program
once it is running and I enclose what I use for the speakfreely
monitor -- this might be of help.

#!/bin/bash
secs=15
while true
do
sleep $secs
if [ `pidof sfspeaker | wc -w` != 2 ]
then
#if there are not two sfspeaker processes
aplay -q /usr/src/speak_freely/busy.au
fi
done

on Monday 10/20/2003 Janina Sajka(janina at rednote.net) wrote
 > I have a command that starts a process. Should that process die whilst
 > I'm not at my computer, I want a script to restart it.
 > 
 > How do I do this? What doc might I read that would provide examples?
 > 
 > I presume I should launch the process so that it's pid is written to a
 > file, and then I can just test for the running pid?
 > 
 > But, I don't know how to go forward with this, so would appreciate all
 > advice and direction.
 > 
 > 
 > -- 
 > 	
 > Janina Sajka
 > Email: janina at rednote.net		
 > Phone: (202) 408-8175
 > 
 > Director, Technology Research and Development
 > American Foundation for the Blind (AFB)
 > http://www.afb.org
 > 
 > Chair, Accessibility Work Group
 > Free Standards Group
 > http://accessibility.freestandards.org
 > 
 > _______________________________________________
 > Speakup mailing list
 > Speakup at braille.uwo.ca
 > http://speech.braille.uwo.ca/mailman/listinfo/speakup

-- 
         John Covici
         covici at ccs.covici.com




[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]
  Powered by Linux