I've been going nuts trying to get my crontab entries to run consistently... It's very odd, it will work for that day when I first edit my user's crontab, but then will just stop working there on out... I think the issue may be somehow associated with my main account that was initially setup with ubuntu server (account has sudo to root; updated to latest version of ubuntu server), because I have another user which has no issue executing crontab entries on a daily basis.
When I go to test, I'll use the same entry, set the time to execute a minute or two after, tail the logs and it works!
But when I set it to run and then after time passes, the entries do not get executed... Here is my current crontab, any insight would be greatly appreciated... I don't believe its a syntax issue because it works initially when testing... I also tried adding an empty line to the bottom as well as the empty MAILTO as you will see below:
Code:
# Edit this file to introduce tasks to be run by cron.
MAILTO=""
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
0 17 * * 1 /home/clue/scripts/MySQLdump.sh > /home/clue/log/MySQLdump.log 2>&1
0 17 * * 5 /home/clue/scripts/MySQLdump.sh > /home/clue/log/MySQLdump.log 2>&1
0 23 * * * /home/clue/scripts/sync_ftp.sh > /home/clue/log/sync_ftp.log 2>&1
0 18 * * * /home/clue/scripts/updateDNS.sh > 2>&1
UPDATE:
I'm looking at my rolled over syslogs and it appears the entries are showing up, but the outcome of my scripts are not working as expected...
Code:
clue@Ubuntu-Server:~/log$ zcat /var/log/syslog.* | grep 'home/clue'
Jun 7 17:00:01 Ubuntu-Server CRON[27422]: (clue) CMD (/home/clue/scripts/MySQLdump.sh > /home/clue/log/MySQLdump.log 2>&1)
Jun 7 18:00:01 Ubuntu-Server CRON[27465]: (clue) CMD (/home/clue/scripts/updateDNS.sh > 2>&1)
Jun 7 23:00:01 Ubuntu-Server CRON[27697]: (clue) CMD (/home/clue/scripts/sync_ftp.sh > /home/clue/log/sync_ftp.log 2>&1)
Jun 6 18:00:01 Ubuntu-Server CRON[18297]: (clue) CMD (/home/clue/scripts/updateDNS.sh > 2>&1)
Jun 6 23:00:01 Ubuntu-Server CRON[18493]: (clue) CMD (/home/clue/scripts/sync_ftp.sh > /home/clue/log/sync_ftp.log 2>&1)
Jun 5 18:00:01 Ubuntu-Server CRON[11018]: (clue) CMD (/home/clue/scripts/updateDNS.sh > 2>&1)
Jun 5 23:00:01 Ubuntu-Server CRON[11224]: (clue) CMD (/home/clue/scripts/sync_ftp.sh > /home/clue/log/sync_ftp.log 2>&1)
Jun 4 18:00:01 Ubuntu-Server CRON[5801]: (clue) CMD (/home/clue/scripts/updateDNS.sh > 2>&1)
Jun 4 23:00:01 Ubuntu-Server CRON[9952]: (clue) CMD (/home/clue/scripts/sync_ftp.sh > /home/clue/log/sync_ftp.log 2>&1)
Jun 3 17:00:01 Ubuntu-Server CRON[758]: (clue) CMD (/home/clue/scripts/MySQLdump.sh > /home/clue/log/MySQLdump.log 2>&1)
Jun 3 18:00:01 Ubuntu-Server CRON[792]: (clue) CMD (/home/clue/scripts/updateDNS.sh > 2>&1)
Jun 3 23:00:01 Ubuntu-Server CRON[3805]: (clue) CMD (/home/clue/scripts/sync_ftp.sh > /home/clue/log/sync_ftp.log 2>&1)
Jun 2 18:00:01 Ubuntu-Server CRON[31673]: (clue) CMD (/home/clue/scripts/updateDNS.sh > 2>&1)
Jun 2 23:00:01 Ubuntu-Server CRON[32212]: (clue) CMD (/home/clue/scripts/sync_ftp.sh > /home/clue/log/sync_ftp.log 2>&1)
The entry I'm really concerned with is the MySQLdump.sh, which script is this:
Code:
#!/bin/sh
/usr/bin/mysqldump -u root db_name | /bin/gzip > /home/clue/cL-backups/cL_`date +"%m_%d_%Y"`.sql.gz
Code:
clue@Ubuntu-Server:~/cL-backups$ ls -lrt
total 2688
-rw-rw-r-- 1 clue clue 382898 May 8 09:45 cL_05_08_2013.sql.gz
-rw-rw-r-- 1 clue clue 383107 May 14 13:02 cL_05_14_2013.sql.gz
-rw-rw-r-- 1 clue clue 383243 May 17 17:00 cL_05_17_2013.sql.gz
-rw-rw-r-- 1 clue clue 383406 May 20 17:00 cL_05_20_2013.sql.gz
-rw-rw-r-- 1 clue clue 383514 May 29 06:58 cL_05_29_2013.sql.gz
-rw-rw-r-- 1 clue clue 383562 May 31 10:51 cL_05_31_2013.sql.gz
-rw-rw-r-- 1 clue clue 383750 Jun 10 06:37 cL_06_10_2013.sql.gz
From the above ls, you should see a file for Jun 7, but it did not show up... I manually ran it today. The only time it worked was on May 17 and May 20, as you can see the timestamp of 17:00... I thought I was in the clear until I started checking and it stopped working... I didn't change anything.
Bookmarks