You are not logged in.
Pages: 1
I had created a bash script which ensures that each of the applications has one instance. The problem is no applications are executed during startup. Here is my script:
if [ -z "ps aux | grep wmCalClock | head -n -1" ]
then
wmCalClock -b 100 -arial -tc cyan -bc black -e xterm &
fi
if [ -z "ps aux | grep wmfire | head -n -1" ]
then
wmfire -L1 -B1 -s0 -C2 -P fireload_temp &
fi
if [ -z "ps aux | grep wmcpuload | head -n -1" ]
then
wmcpuload -lc red -a 95 &
fi
if [ -z "ps aux | grep wmmemload | head -n -1" ]
then
wmmemload -lc red -am 95 &
fi
Last edited by heyya (2009-12-25 04:19:33)
Offline
Well, obviously not, as the string "ps aux | grep wmCalClock | head -n -1" is
never empty What you probably wanted to write is
"$(ps aux | grep wmCalClock | head -n -1)"
This will put the output of the script into the string, rather than taking the
command string itselft.
Offline
thanks
Offline
Oops! "$(ps aux | grep wmCalClock | head -n -1)" should be "$(ps aux | grep wmCalClock | head -n 1)" and also for the rest.
Last edited by heyya (2009-12-24 08:58:08)
Offline
Just a hint for you:
I'm not sure if this will work the way you expect it. At least for me, doing a
grep on a ps output usually yields the grep itself, which is not a problem if
I'm looking at it. For use in a script like this, however, it might become a
problem.
Offline
Use pgrep.
/etc/rc.d/ is where daemons reside. Beware.
Offline
Use pgrep.
This, and note that pgrep also returns true/false beside stdout. So you can do if ! pgrep wmCalClock; then wmCalClock; fi
Offline
thanks guys
Offline
Pages: 1