Help with setting cron job with if condition
Hi guys,
I own a vu+ solo se v2 box and the external usb hdd spins down automatically every 5 minutes. To fix this I used successfully this cron job: */4 * * * * touch /media/hdd/keepalive.log The problem is that I would like this cron job to NOT work when the vu+ BOX is in standby so the hdd can have a rest. For this purpose I had some help but something is missing I guess because it does not work. Here is what I tried: -powerstate.sh Code: #!/bin/sh if (wget -O - -q http://localhost/web/powerstate|grep -i false) then touch /media/hdd/keepalive.log fi -crontab file to: Code: */4 * * * * /root/powerstate.sh 2>&1 > /dev/null - and Code: wget -O - http://localhost/web/powerstate says: <e2powerstate> <e2instandby>false</e2instandby> </e2powerstate> Any ideas, please??? and remember that I have no clue about all this, so be patient |
The parentheses around the if condition are unlikely to work. Remove them.
Inside cron, you have a very limited environment, so that you need to use absolute pathnames for commands like wget. |
Something like
Code:
#!/bin/bash NB: I don't have the HW to test this.... Also, as above, use full paths for cmds in cron jobs |
All times are GMT -5. The time now is 10:18 AM. |