Solved

Error when adding a entry to the crontab

Posted on 2004-09-23
11
673 Views
Last Modified: 2013-12-27
Hi,

I am trying to add a new entry to the crontab:
$crontab -l mycron
$vi mycron
...
$crontab mycron

then I got an email message from root saying:
Your "crontab" on hostname

    unexpected end of line

This entry has been ignored.

Can anybody tell me what is wrong? Thanks,
0
Comment
Question by:ebi168
  • 4
  • 2
  • 2
  • +3
11 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 12138539
As I recall that's usually caused by the crontab file not ending on an empty line. When editing the crontab file the last line in the file must be an empty line.
0
 

Author Comment

by:ebi168
ID: 12138555
I tried so but still getting the message. Any other suggestions? Thanks
0
 
LVL 20

Assisted Solution

by:tfewster
tfewster earned 50 total points
ID: 12138721
> crontab -l mycron
I presume this is a typo: crontab -l needs to be explicitly redirected to a file with ">", i.e. `crontab -l > mycron`  Otherwise, the "mycron" file you're editing is unrelated to the contents of your crontab ;-)

Next possible issue is mismatched ",' or bracket characters in a line in the cron file; Please post the output of `crontab -l` before & after editing and (if different!) the contents of "mycron"
0
 

Author Comment

by:ebi168
ID: 12138747
Yeah. I used crontab -l > mycron. Now even I delete the row I added, I got the same error. Sometimes vi does weird things, if I retype the exact same thing in a new file things will work. I don't know if this is the same reason. The crontab job list is quite long:

10 3 * * 0,4 /etc/cron.d/logchecker
10 3 * * 0   /usr/lib/newsyslog
15 3 * * 0 /usr/lib/fs/nfs/nfsfind
1 2 * * * [ -x /usr/sbin/rtc ] && /usr/sbin/rtc -c > /dev/null 2>&1
30 3 * * * [ -x /usr/lib/gss/gsscred_clean ] && /usr/lib/gss/gsscred_clean
5 23 * * * /usr/local/bin/osdump.sh
00 23 * * 1-5  /usr/local/bin/oracle-coldbackup-incr.sh
#00 0 * * 6 /usr/local/bin/oracle-coldbackup-full.sh
00 0 * * 0 /usr/local/bin/oracle-coldbackup-full.sh
40 1 * * 1-5 /usr/local/bin/sap-coldbackup-incr.sh
00 4 * * 6 /usr/local/bin/sap-coldbackup-full.sh
00 22 * * 2-6 su - ora2 -c /data/u03/oracle/oracle8i/local/sbexport
00 3 * * 1-5 su - oracle -c /u03/oracle/local/dbstart
00 5 * * 0 su - ora2 -c /u03/oracle/admin/sbstart
00 12 * * 1-6 ./manager/rmsbdmp
#00 3 * * 2-5  /u03/oracle/admin/compfile > /dev/null 2>&1
10 23 * * 2-5  /u03/oracle/admin/compfile > /dev/null 2>&1
00 4 * * *     /u03/oracle/admin/compfile2 > /dev/null 2>&1
00 6 * * 6,0  /u03/oracle/admin/compfile > /dev/null 2>&1
00 1 * * *  /u03/oracle/admin/rmdbarchive > /dev/null 2>&1
30 8 * * 0 ./manager/rmoralog
30 8-11,12-4 * * * ./manager/iostrpt
0 7 * * 1 ./manager/iostwkrpt
0 8 * * 1 su - oracle -c /u03/oracle/admin/orarpt1 > /dev/null 2>&1
0 17 * * 5 su - oracle -c /u03/oracle/admin/orarpt2 > /dev/null 2>&1

00,15,30,45 8-16 * * 1-5 su - oracle -c /u03/oracle/admin/oratest > /dev/null 2>&1
#30 17-23,4-7 * * 1-5 su - oracle -c /u03/oracle/admin/oratest > /dev/null 2>&1
30 17-22,4-7 * * 1-5 su - oracle -c /u03/oracle/admin/oratest > /dev/null 2>&1
40 5-23 * * 6 su - oracle -c /u03/oracle/admin/oratest > /dev/null 2>&1
30 8-23 * * 0 su - oracle -c /u03/oracle/admin/oratest2 > /dev/null 2>&1
30 6,12,16 * * 1-6 su - oracle -c /manager/chkspace/oraspchk > /dev/null 2>&1
45 8,12,16 * * 0 su - oracle -c /manager/chkspace/oraspchk > /dev/null 2>&1
00,30 0-23 * * 1-6 /manager/pingtest/pingtest > /dev/null 2>&1
00,30 8-23 * * 0 /manager/pingtest/pingtest2 > /dev/null 2>&1

50 03 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_uzip
05 04 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_salesarea
10 04 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_allzip
15 04 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_salesorder
59 08 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_salesorder_noon
59 09 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_salesorder_noon
59 10 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_salesorder_noon
29 11 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_salesorder_noon
10 13 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_salesorder_noon
59 13 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_salesorder_noon
59 14 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_salesorder_noon
59 15 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_salesorder_noon
10 17 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_salesorder_noon
00 04 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_newsalesorder
00 04 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_invoice
20 04 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_net_sales
25 04 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_rg
30 04 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_service_report
00 21 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_prospect_status
05 17 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_reservation
# 00 18 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_vendor
30 05 * * 6,0 su - bguser -c /u04/interface/DB1/scripts/proc_invoice
35 05 * * 6,0 su - bguser -c /u04/interface/DB1/scripts/proc_newsalesorder
50 05 * * 6,0 su - bguser -c /u04/interface/DB1/scripts/proc_net_sales
50 05 * * 6,0 su - bguser -c /u04/interface/DB1/scripts/proc_rg
55 05 * * 6,0 su - bguser -c /u04/interface/DB1/scripts/proc_uzip
58 05 * * 6,0 su - bguser -c /u04/interface/DB1/scripts/proc_salesarea
00 06 * * 6,0 su - bguser -c /u04/interface/DB1/scripts/proc_service_report
00 07 * * 6   su - bguser -c /u04/interface/DB1/scripts/proc_customer
00 06 * * 6,0 su - bguser -c /u04/interface/DB1/scripts/proc_service_report
00 18 * * 1-6 su - bguser -c /u04/interface/DB1/scripts/ftp_xxcust
00 18 * * 1-6 su - bguser -c /u04/interface/DB1/scripts/ftp_siebel
00 07 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_customer
30 04 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_material
00 07 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_machavl
45 12 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_machavl
15 12 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_customer
10 12 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_material
50 17 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_customer
30 18 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_customer
#
05 09 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_so_status
05 10 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_so_status
05 11 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_so_status
# 35 11 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_so_status
15 13 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_so_status
05 14 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_so_status
05 15 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_so_status
05 16 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_so_status
00 18 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_so_status
45 06 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_inventory_daily
00 20 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_ar_daily
30 21 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_openpo
30 21 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_order_type
30 21 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_billing_type
# 30 21 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_value_contract
45 21 * * *   su - bguser -c /u04/interface/DB1/scripts/proc_ar_settlement
45 05 1 * *   su - bguser -c /u04/interface/DB1/scripts/proc_inventory_monthend
00 05 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/proc_po_receiving
#45 05 1 * *   su - bguser -c /u04/interface/DB1/scripts/proc_invoicemonthly
45 05 1 * *   su - bguser -c /u04/interface/DB1/scripts/proc_sales_history
25 05 * * 2-6 su - oracle -c /u03/oracle/admin/DB2/exp/exp_SUNDB2_aai_as400
00 06 * * 6   su - oracle -c /u03/oracle/admin/DB2/exp/exp_SUNDB2_aai_efw
#
30 10 * * 1-6 su - bguser -c /u04/interface/DB1/scripts/pos_from_japan_ftp
30 14 * * 1-6 su - bguser -c /u04/interface/DB1/scripts/pos_to_japan_ftp
#45 20 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/aop_sales_reports
#45 14 * * 1-5 su - bguser -c /u04/interface/DB1/scripts/amtpur /interface/DB1/pos_to_japa
n amtpur.txt
#
00 14 * * * /usr/local/bin/space_check.sh > /dev/null 2>&1
#00 6,12 * * * /usr/local/bin/del_logfiles.sh
10 19 * * 0,4 /etc/cron.d/logchecker
10 19 * * 0   /usr/lib/newsyslog
15 19 * * 0 /usr/lib/fs/nfs/nfsfind
1 18 * * * [ -x /usr/sbin/rtc ] && /usr/sbin/rtc -c > /dev/null 2>&1
#30 21 * * 1-5 su - groy -c /u04/interface/DB1/scripts/proc_open_po
#00 2 4 4 * /manager/ctime > /dev/null 2>&1
#30 18 5 3 * /tmp/restart
0
 
LVL 38

Accepted Solution

by:
yuzh earned 350 total points
ID: 12139087
looks like it the old cron bug!

You should use the following procedure (commands)  crontab:

EDITOR=vi
export EDITOR
crontab -e

PS: you need to check every line in your crontab to make sure each line is CLEAN (no
      spacial chars in between).  Make sure there is no BLANK line in your crontab (comment
      line ok). I can see there are BLANK lines in your crontab.



     
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 40

Assisted Solution

by:jlevie
jlevie earned 50 total points
ID: 12139098
Yep, the embedded empty lines are a problem.
0
 

Author Comment

by:ebi168
ID: 12139172
Will these empty lines affect the running of those jobs? I have restored the crontab file from backup. And I used crontab -e to get into the file (just to test) and do nothing then exit, I still get the error message. However, the cron jobs are going well. I couldn't test today on the crontab file, but I will do it tommorrow to see what will happen after removing the empty lines. Thanks
0
 
LVL 18

Assisted Solution

by:liddler
liddler earned 50 total points
ID: 12140845
No they don't affect the jobs, you just get the error message
0
 
LVL 3

Expert Comment

by:cagri
ID: 12141606
Please check None of your disk are full (%100)
0
 

Author Comment

by:ebi168
ID: 12146913
Thanks for all your advice. One more question is:

"No they don't affect the jobs, you just get the error message":

But the error message says "This entry has been ignored." Is it possible one of the task will be ignored and not carried out?
0
 
LVL 18

Expert Comment

by:liddler
ID: 12156613
No the blank line has been ignored, as it's not a valid cron entry
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now