Re: crontab same time execution order
At 10:43 PM -0700 7/4/03, Dave McCammon wrote: 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. I'm not a big fan of programming to take advantage of undocumented implementation details; they may change unexpectedly. Why not: * Write a wrapper script that does the desired ancillary actions, running the original command in the process: : # newsyslog_lcl - wrapper for newsyslog ... pre-actions ... newsyslog ... post-actions ... * Change /etc/crontab to invoke newsyslog_lcl, rather than newsyslog The usual caveats apply, of course, to writing root-level programs. -r -- email: [EMAIL PROTECTED]; phone: +1 650-873-7841 http://www.cfcl.com/rdm- my home page, resume, etc. http://www.cfcl.com/Meta - The FreeBSD Browser, Meta Project, etc. http://www.ptf.com/dossier - Prime Time Freeware's DOSSIER series ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: crontab same time execution order
--- Chuck Swiger [EMAIL PROTECTED] 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 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: crontab same time execution order
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 -- -Chuck ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]