Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The first noncomment line in a legacy crontab file begins with five asterisks:

* * * * * ([a_command]) >/dev/null 2>&1

The authors are gone, so I do not know their intent. What does all-wildcards mean to (Solaris 8) cron? The betting here is either run once, run continuously, or run never, which is unfortunately broad.

If you are wondering about the comment line preceding this, it is "Do not delete."

share|improve this question
3  
Something else to note, since it tripped me up severely at work recently: the >/dev/null 2>&1 section feeds all output from STDOUT and STDERR to /dev/null. The reason this is done: If you don't, then output from the program called in crontab will be mailed to the local mailbox of the user. Before I knew this I filled up a hard drive on a production server from a script running every two minutes. –  Luke has no name Jul 24 '10 at 7:16
    
Thanks, Luke has no name; I had mis-attributed it to over-fussiness. –  Thomas L Holaday Aug 18 '10 at 19:36
add comment

2 Answers

up vote 22 down vote accepted

Every minute of every day of every week of every month, that command runs.

man 5 crontab has the documentation of this. If you just just type man crontab you get the documentation for the crontab command. What you want is section 5 of the manual pages which covers system configuration files including the /etc/crontab file. For future reference, the sections are described in man man:

   1   Executable programs or shell commands
   2   System calls (functions provided by the kernel)
   3   Library calls (functions within program libraries)
   4   Special files (usually found in /dev)
   5   File formats and conventions eg /etc/passwd
   6   Games
   7   Miscellaneous  (including  macro  packages and conven‐
       tions), e.g. man(7), groff(7)
   8   System administration commands (usually only for root)
   9   Kernel routines [Non standard]
share|improve this answer
    
That's the literal meaning; I was worried that it might be a special case. Thanks for the reassurance. –  Thomas L Holaday Jul 20 '10 at 21:19
5  
+1 for the answer, -1 for the man cron comment. man pages are notoriously hard to read and understand for the beginner - that's why people come here, to have the man pages explained to them. –  Mark Henderson Jul 20 '10 at 21:25
4  
Totally, because it should have been man 5 crontab. That manpage is more specific and very easy to understand. See: linux.die.net/man/5/crontab –  Warner Jul 20 '10 at 21:34
5  
That's fine, provided the user is aware that the 5 is even relevant. Most new or part time Linux users don't know what number, if any, to use to access man pages. –  John Gardeniers Jul 20 '10 at 21:43
2  
@John, to prove your point, as someone who only dips their toe into *nix when I need to restart the occasional apache server, I was not even aware you could do a man 5 and I have no idea what would happen if I did... –  Mark Henderson Jul 21 '10 at 3:19
show 5 more comments
First star = Minutes: 0-59
Second star = Hours: 0-23
Third star = Day of Month: 0 - 31
Fourth star = Month: 0 - 12
Fifth star = Day of Week: 0 - 6 (0 means sunday)

Say you want to run something every 1st of every month.

0 0 1 * * something.sh
share|improve this answer
1  
That means to run something every minute of every hour on the 1st of every month (that would be 1440 times on day 1). –  Kevin Brock Jul 21 '10 at 4:41
    
Oh yeah, let me edit that. –  Michael Burns Jul 21 '10 at 18:37
add comment

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.