Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Recently a user on one of our systems (linux Ubuntu, but any *nix would be the same) had a crontab file missing a terminating newline.

It is common for *nix configuration files to require that terminating newline, cron being no different. However, no warning is provided when adding a file with no newline, and the command is never executed.

So, two fixes identify themselves.

  1. Run a cron process to check for these files.
  2. Provide a friendlier front end to cron.

The second is what this question is about. Either something to check the syntax before entering the file, or to front the whole entry process, which is a bit arcane anyway.

For this particular machine a command-line tool would be needed, since it is located at a data centre, and an X environment is not installed.

share|improve this question
    
Part of the problem might be the truly ancient version of cron installed on the (Ubuntu) machine - Vixie cron from 1993. My Fedora has a 2007 version, which no longer has a comment in the manual about missing EOL being a bug (which the 1993 one does). –  Peter Sep 24 '09 at 1:18
2  
Does that mean you're also editing the crontab as a regular file rather than using "crontab -e"? I assume you have a good reason to continue using the truly ancient version. –  Doug Harris Sep 24 '09 at 20:48

4 Answers 4

up vote 1 down vote accepted

I like the cron interface in webmin.

share|improve this answer
1  
Looks good. Thanks. webmin.com/usermin.html –  Peter Sep 26 '09 at 13:41

I've always found that the syntax coloring in vim was enough to do this for me. I haven't run into the newline problem simply because I've trained myself to be automatic with it, like driving is, so you get those experiences where you drive while thinking about something absorbing and you get out of the car and wonder to yourself "How did I get here? I don't remember the trip at all!" --- "Damn, where did all these newlines come from?"

share|improve this answer

There is now CronSandbox.

This is a 'sandbox', somewhere safe to explore crontab commands. Enter the timing values, CronSandbox validates the syntax and delivers the future dates and times the job would execute.

share|improve this answer

I changed my default editor to emacs, which asks if you want to end the buffer with a newline on exit :)

setenv EDITOR <editor>

in your .bashrc (or appropriate) should handle that solution :)

To answer part two of your question, you can also just drop scripts in the cron.<period> directories in /etc

share|improve this answer
    
Yes, me too. In fact I thought this user did also, so I was surprised he had a missing newline. But since there are a few users, I thought maybe there was a text-based tool, like the gnome graphical one someone suggested, but that answer seems to be gone now. Thanks. –  Peter Sep 24 '09 at 1:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.