Date: Fri, 4 Jul 2003 22:43:37 -0700 (PDT) From: Dave McCammon <davemac11@yahoo.com> To: Chuck Swiger <cswiger@mac.com> Cc: freebsd-questions@freebsd.org Subject: Re: crontab same time execution order Message-ID: <20030705054337.21573.qmail@web41409.mail.yahoo.com> In-Reply-To: <3F04CE32.6040204@mac.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--- Chuck Swiger <cswiger@mac.com> 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 time. 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 back. __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030705054337.21573.qmail>