March 14, 201115 yr Hey guys, I added this to my GO file last week, taking the script Joe made for the monthly parity check and modifying to run weekly... Woke up this morning, and nada. Just wondering what I missed.... In my GO file I have: /boot/weekly_parity_check.sh Within this "weekly" file i have: #!/bin/sh crontab -l >/tmp/crontab grep -q "/root/mdcmd check" /tmp/crontab 1>/dev/null 2>&1 if [ "$?" = "1" ] then echo "# check parity every Sun at 1 am:" >>/tmp/crontab echo "0 2 * * Mon /root/mdcmd check NOCORRECT 1>/dev/null 2>&1" >>/tmp/crontab cp /tmp/crontab /var/spool/cron/crontabs/root- crontab /tmp/crontab fi All looks good to me. If I do a crontab -l on my console I get: # check parity every Sun at 1 am: 0 2 * * Mon /root/mdcmd check NOCORRECT 1>/dev/null 2>&1 Yes, I know i have the wrong date and time in the title section. Just wondering why nothing ran. Thanks!
March 14, 201115 yr Hey guys, I added this to my GO file last week, taking the script Joe made for the monthly parity check and modifying to run weekly... Woke up this morning, and nada. Just wondering what I missed.... In my GO file I have: /boot/weekly_parity_check.sh Within this "weekly" file i have: #!/bin/sh crontab -l >/tmp/crontab grep -q "/root/mdcmd check" /tmp/crontab 1>/dev/null 2>&1 if [ "$?" = "1" ] then echo "# check parity every Sun at 1 am:" >>/tmp/crontab echo "0 2 * * Mon /root/mdcmd check NOCORRECT 1>/dev/null 2>&1" >>/tmp/crontab cp /tmp/crontab /var/spool/cron/crontabs/root- crontab /tmp/crontab fi All looks good to me. If I do a crontab -l on my console I get: # check parity every Sun at 1 am: 0 2 * * Mon /root/mdcmd check NOCORRECT 1>/dev/null 2>&1 Yes, I know i have the wrong date and time in the title section. Just wondering why nothing ran. Thanks! Probably because the date syntax is not understood. The day of the week is represent by a number from 0-6 (0=sunday) perhaps try this: 0 2 * * 1 /root/mdcmd check NOCORRECT 1>/dev/null 2>&1
March 14, 201115 yr Author Ahh, thanks! I had done some research on dates and cron and thought for days of the week you could use that, at least the example I saw showed that. I will change it to run tonight and see if it work. Shawn
March 14, 201115 yr Author Modified the "Mon" to a "1" to test and worked like a charm! Thanks! Shawn
Archived
This topic is now archived and is closed to further replies.