Jump to content

"Weekly" parity check - not run [SOLVED]


Recommended Posts

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!

 

Link to comment

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

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...