× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

Re: cron.d execution problem

themadhatter
Aspirant

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!
Message 1 of 2
themadhatter
Aspirant

Re: cron.d execution problem

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.
Message 2 of 2
Top Contributors
Discussion stats
  • 1 reply
  • 2479 views
  • 0 kudos
  • 1 in conversation
Announcements