Crontab error

Kamran Arshad
Kamran Arshad used Ask the Experts™
on
Hi,

I am getting this error while editing the crontab?

crontab: installing new crontab
"/tmp/crontab.XXXXePsNSJ":2: bad day-of-week
errors in crontab file, can't install.
Do you want to retry the same edit?

The crontab value is a below;

### recording mixing for Asterisk run every 5 minutes
1,6,11,16,21,26,31,36,41,46,51,56 * * *
1,2,3,4,5,6 /usr/share/astguiclient/AST_CRON_mix_recordings_BASIC.pl
### keepalive script for astguiclient processes
* * * * * /usr/share/astguiclient/ADMIN_keepalive_ALL.pl
### kill Hangup script for Asterisk updaters
* * * * * /usr/share/astguiclient/AST_manager_kill_hung_congested.pl
### updater for voicemail
* * * * * /usr/share/astguiclient/AST_vm_update.pl
### updater for conference validator
* * * * * /usr/share/astguiclient/AST_conf_update.pl
### flush queue DB table every hour for entries older than 1 hour
11 * * * * /usr/share/astguiclient/AST_flush_DBqueue.pl -q
### fix the vicidial_agent_log once every hour
33 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl
### updater for VICIDIAL hopper
* * * * * /usr/share/astguiclient/AST_VDhopper.pl -q
### adjust the GMT offset for the leads in the vicidial_list table
1 1 * * * /usr/share/astguiclient/ADMIN_adjust_GMTnow_on_leads.pl --
debug --postal-code-gmt
### reset several temporary-info tables in the database
2 1 * * * /usr/share/astguiclient/AST_reset_mysql_vars.pl
### optimize the database tables within the asterisk database
3 1 * * * /usr/share/astguiclient/AST_DB_optimize.pl
## adjust time on the server with ntp
30 * * * * /usr/local/bin/ntpdate -u 18.145.0.30 2>/dev/null 1>&2
### VICIDIAL agent time log weekly summary report generation
2 0 * * 0 /usr/share/astguiclient/AST_agent_week.pl


Your help is highly appreciated.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Cron can spit out some terrible messages when it comes to troubleshooting. It appears to be caling out line 2 as an issue but that may not be the exact, or only issue. There is a script you can write/run that may give you more insight in to what is happening - here's a link to the "Wicked cool shell script..." book that has the code (page 148) :
http://books.google.com/books?id=Df7P1WyG87sC&pg=PA147&lpg=PA147&dq=/tmp/crontab:2:+bad+day-of-week&source=bl&ots=duQwpnGCGJ&sig=R7KsUaQdd7MZzVvLkQ7DktBljOI&hl=en&ei=diEvTPnaBIOKlwfQk93MCQ&sa=X&oi=book_result&ct=result&resnum=2&ved=0CBgQ6AEwAQ#v=onepage&q&f=false

Hopefully this will help you catch the issue.
Kamran ArshadIT Associate

Author

Commented:
thanks for the comment. I have narrowed down the entries.. only below entries are wrong;

### adjust the GMT offset for the leads in the vicidial_list table
1 1 * * * /usr/share/astguiclient/ADMIN_adjust_GMTnow_on_leads.pl --
debug --postal-code-gmt

### recording mixing for Asterisk run every 5 minutes
1,6,11,16,21,26,31,36,41,46,51,56 * * *
1,2,3,4,5,6 /usr/share/astguiclient/AST_CRON_mix_recordings_BASIC.pl

could you please tell what are the errors?
Top Expert 2007

Commented:
I can't see anything obvious, but I can tell you that

1,6,11,16,21,26,31,36,41,46,51,56 * * *
1,2,3,4,5,6 /usr/share/astguiclient/AST_CRON_mix_recordings_BASIC.pl

is better written as

1/5 * * *
1-6 /usr/share/astguiclient/AST_CRON_mix_recordings_BASIC.pl
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Top Expert 2007
Commented:
Ah, just wondering if that cron entry is split across two lines.

Commented:
Good call Tintin - those are the only two in the list that 'wrap' and seem to be the only two that are choking.
Kamran ArshadIT Associate

Author

Commented:
sorry but I did not understand ...how can I correct it?
Commented:
Tintin was pointing out that it appears that the two items in question are actually two lines of code rather than one long one - cron stops at the end of the line, which in these two cases the command isn't complete.  You need to make sure there isn't a line break at the end of the first line of those two entries. They need to all be on one line.
Kamran ArshadIT Associate

Author

Commented:
Thanks folks...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial