• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 690
  • Last Modified:

Error when adding a entry to the crontab

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
ebi168
Asked:
ebi168
  • 4
  • 2
  • 2
  • +3
4 Solutions
 
jlevieCommented:
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
 
ebi168Author Commented:
I tried so but still getting the message. Any other suggestions? Thanks
0
 
tfewsterCommented:
> 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
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
ebi168Author Commented:
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
 
yuzhCommented:
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
 
jlevieCommented:
Yep, the embedded empty lines are a problem.
0
 
ebi168Author Commented:
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
 
liddlerCommented:
No they don't affect the jobs, you just get the error message
0
 
cagriCommented:
Please check None of your disk are full (%100)
0
 
ebi168Author Commented:
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
 
liddlerCommented:
No the blank line has been ignored, as it's not a valid cron entry
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 4
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now