NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

themadhatter's avatar
themadhatter
Aspirant
Feb 15, 2013

cron.d execution problem

Hello all,

I read another forum post here: viewtopic.php?f=35&t=47288

I have a file "remote_backup_maintenance" in /etc/cron.d with these contents:

30 13 * * * root /etc/frontview/addons/bin/REMOTE_BACKUP/remote_backup_maintenance.sh


I have an extra blank line at the end of the file.

I have remote_backup_maintenance.sh in /etc/frontview/addons/bin/REMOTE_BACKUP/ with contents:

#!/bin/bash
# email results of maintenance daily via /etc/cron/remote_backup_maintenance

# variables
EMAILMESSAGE="/tmp/remote_backup_maintenance.txt"

# Build mail formatted file
echo "date: `date +%Y-%m-%d`" > $EMAILMESSAGE
echo "to: name@name.com" >> $EMAILMESSAGE
echo "subject: NAS Remote Backup Maintenance `date +%Y-%m-%d`" >> $EMAILMESSAGE
echo "from: name@name.com" >> $EMAILMESSAGE

# The message body
echo "Greetings!" >> $EMAILMESSAGE
echo -e "\nThe backup maintenance script ran with the following results:" >> $EMAILMESSAGE
echo -e "\nDeleted:" >> $EMAILMESSAGE
ls -t /c/remote_backup/backup* | sed -e '1,7d' >> $EMAILMESSAGE
ls -t /c/remote_backup/backup* | sed -e '1,7d' | xargs -d '\n' rm
echo -e "\n\nCurrent inmotion backups:" >> $EMAILMESSAGE
ls -la /c/remote_backup/backup* >> $EMAILMESSAGE
echo -e "\nFinished cleanup @ `date +%H:%M:%S`.\n\nHave a great day!" >> $EMAILMESSAGE
echo "." >> $EMAILMESSAGE

# Send the email -->use -v below for debugging!
/usr/sbin/sendmail -f"name@name.com" "name@name.com" < $EMAILMESSAGE


I can run the following at the command line:

bash /etc/frontview/addons/bin/REMOTE_BACKUP/remote_backup_maintenance.sh


It executes fine and I get an email.

However, it doesn't appear that the cron job is executing. I've tried each seperately and one after the other:

/etc/init.d/cron force-reload


and

/etc/init.d/cron restart


Any ideas why this cron job isn't running?

Thanks!

1 Reply

Replies have been turned off for this discussion
  • Strange behavior! I got this to work for me yesterday afternoon with the exact steps above, just adjusting the time to be 10-15min ahead of current time. I thought I had this set, then I set it to a time that should have triggered this morning, and nothing! What the heck????

    I would love to hear if someone has ideas!

    Thanks.

NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology! 

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More