Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CRONTAB MISTAKE

Status
Not open for further replies.

stovie

Technical User
Apr 7, 2003
32
US

Hi. I hope someone can help me with this problem.
Being a novice to Unix, I editted my crontab directly
by typing " crontab -e ". Well, I needed to make some
changes so, I typed " crontab -r ". Now I have no crontab,
and I can't seem to get crontab to write a new file.

I' ve tried:

vi somefile
crontab somefile

I get the following errors:

crontab:
crontab: error on previous line; unexpected character found in line.

What might be my options from here. Any help will be greatly appreciated.

 
What is in 'somefile'? Sounds like you may have a strange character in there (possibly a control char?). I'd try recreating 'somefile' and try again.
 
Hi stovie.

Do you have any known good backup media of some sort? Restoring the file from it might prove to be the fastest way to fix the issue.
 
Thanks for your suggestions. I have corrected the problem
by recreating a root crontab file and placing it in the /usr/spool/crontabs directory.

Now when I type "crontab -l" I see the new crontab file I created; however, I still get the "crontab: error on previous line; unexpected character found in line" error when I try to overwrite my exisiting crontab file with the command "crontab somefile."

 
If you end the 'crontab' file with a 'nl', you'll get that error. Just be sure the LAST character in the file, is NOT a 'nl' or, from a viewer's standpoint, a blank line.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top