A Simple Script
Hi,
I am trying to write a simple script, that we be activated by CRON every hour, to check whether WGET is working or not. If its not working - it should activate it. What I have so far: #!/bin/bash ps ax > tempdata grep -q wget tempdata if [ $? -eq "0" ] then echo "Already Working" else wget -m ....... fi rm -f tempdata Anyone has a suggestion how to write this script, without creating a file? (TEMPDATA) Simply writing "ps ax | grep wget" is not good, cuz grep will always find the process "grep wget".... Thanks in Advance, |
ps ax | awk '{print $5}' | grep wget
doesnt pick up 'grep wget' because the wget is in field 6, although it would be simpler to use pidof |
thank you.
worked perefectly. |
pgrep wget >/dev/null && echo "Is working" || echo "Aint working"
|
All times are GMT -5. The time now is 07:13 PM. |