crontab same time execution order

Dave McCammon davemac11 at
Fri Jul 4 22:43:38 PDT 2003

--- Chuck Swiger <cswiger at> wrote:
> Dave McCammon wrote:
> > If two entries in the crontab are for the same
> time,
> > which entry gets ran first?
> It's not deterministic, or if it happens to be so
> under FreeBSD, it's not on 
> other platforms and you should not rely on a
> particular order.
> If you've got commands which depend on each other in
> cron, do something like:
> 	command1 ; command2 ; command3
> ...or...
> 	command1 && command2 && command3

Thanks for the reply.
Basically, what I am looking for is to get a command
to run right before newsyslog rotates a log
file(awstats and apache log file.
After I sent the message, I started playing with
/etc/crontab and noticed that the lower on the list
the sooner the command would run (per /var/log/cron)
in comparison with a command set to run at the same
What I did was put an 'echo' command above the
newsyslog entry, restarted cron,waited for top of
hour, checked log, moved command below the newsyslog
entry, restarted cron, waited for top of hour and
checked log file.
The command ran before cron when listed lower and then
ran after when command was listed above the newsyslog
entry. I also noticed that when the 'atrun' command
runs at the top of the hour, it will run after the
newsyslog entry and newsyslog is listed lower in the
/etc/crontab file.

Perhaps this predictable behavior is in FreeBSD only.
(I don't have access to other platforms). Or perhaps
my simple test was too simple. It just seemed to be
too predictable to not at least try to get some feed

Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

More information about the freebsd-questions mailing list