Re: cron jobs not done during sleep
In response to Steve Franks [EMAIL PROTECTED]: Correct me if I'm wrong, but cron doesn't keep track of the last time something was done, does it? Which is to say if my system is crashed, was asleep, or powered off when a job is supposed to happen, it will not happen the next time the system is successfully operational, will it? It's not obvious to me for sure either way from any sources I've read (man crontab, google), and unix tends towards k.i.s.s. (which is why we like it) ...I understand why that would be important behavior if something would cause problems executed other than 9am on Mondays... Is there a tool or setting to implement this functionality? I want something to happen weekly, I don't care when. Assume I am off the commercial power grid and I'm not going to leave my system powered on just to make sure my backups get run. I use it when I need it, then I turn it off. More people should. Electricity is not free from a economic, social, or environmental perspective, and promises to be less so with time. BSD's cron doesn't have this functionality. The Linux folks have a cron-ish program that does recognize when jobs have been missed and runs them at the earliest opportunity. I dislike it, personally, but I can see where it's convenient in some circumstances. http://anacron.sourceforge.net/ It's in ports. -- Bill Moran http://www.potentialtech.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: cron jobs not done during sleep
On Mon, Sep 17, 2007 at 08:22:45AM -0700, Steve Franks wrote: Correct me if I'm wrong, but cron doesn't keep track of the last time something was done, does it? Which is to say if my system is crashed, was asleep, or powered off when a job is supposed to happen, it will not happen the next time the system is successfully operational, will it? It's not obvious to me for sure either way from any sources I've read (man crontab, google), and unix tends towards k.i.s.s. (which is why we like it) ...I understand why that would be important behavior if something would cause problems executed other than 9am on Mondays... Is there a tool or setting to implement this functionality? I want something to happen weekly, I don't care when. Assume I am off the commercial power grid and I'm not going to leave my system powered on just to make sure my backups get run. I use it when I need it, then I turn it off. More people should. Electricity is not free from a economic, social, or environmental perspective, and promises to be less so with time. Is easy enough to implement yourself. Write a script containing your weekly commands. Launch it every hour or so. First thing in your script look for a flag file indicating last time your script was run. If it does not exist, create it (suggest using touch), and run the rest of your script. If the flag file does exist compare dates. If older than some specified interval then touch(1) it and run the rest of your script. Might get fancy and code the date test in the crontab command field. /var/run might be a good place to put your flag file. Notice the test(1) utility can compare new/older file dates and that touch(1) can stamp a future date on the file. You can compile a future date with date -v +1W. Play with the formatting options to make the output compatible with input to touch. -- David Kelly N4HHE, [EMAIL PROTECTED] Whom computers would destroy, they must first drive mad. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: cron jobs not done during sleep
On Mon, 17 Sep 2007 08:22:45 -0700 Steve Franks [EMAIL PROTECTED] wrote: Is there a tool or setting to implement this functionality? I want something to happen weekly, I don't care when. One way is to install a crontab replacement like fcron, but the easiest way to handle this is to install anacron, which works in conjunction with crontab. With anacron you need to comment out the three periodic calls in /etc/crontab so anacron can schedule them itself - it has a default .conf file to do this. Adding anacron_enable=yes to rc.conf causes it to run tasks at boot-up. You should also add one or more entries to crontab to make it run during the night. 0004 ***root/usr/local/sbin/anacron It's actually not essential to set anacron_enable=yes I just use crontab to run it several times a day at convenient time. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: cron jobs
shawn wrote: I installed MRTG and got it working. Noticed that it seemed it was not polling on its own. So I changed the cron job to make it poll more often and in fact its not polling on its own. Also noticed that I stopped receiving my Dailey, reports via email.. I'm also trouble shooting a send mail issue though so that don't really surprise me. I did sh /etc/crontab and got this /etc/crontab: */1: not found /etc/crontab: */1: not found 0: not found 1: not found 15: not found 30: not found 1,31: not found I thought it looked funny so I looked at Logs ... skywalker /usr/sbin/cron[41045]: (root) CMD (/usr/libexec/atrun) skywalker /usr/sbin/cron[41051]: (root) CMD (/usr/libexec/atrun) /usr/sbin/cron[41056]: (root) CMD (/usr/libexec/atrun) /usr/sbin/cron[41066]: (root) CMD (/usr/libexec/atrun) /usr/sbin/cron[41070]: (root) CMD (/usr/libexec/atrun) /usr/sbin/cron[41074]: (root) CMD (/usr/libexec/atrun) /usr/sbin/cron[41094]: (root) CMD (/usr/libexec/atrun) /usr/sbin/cron[41109]: (root) CMD (/usr/libexec/atrun) /usr/sbin/cron[41115]: (root) CMD (/usr/libexec/atrun) /usr/sbin/cron[41127]: (root) CMD (/usr/libexec/atrun) Nothing looked odd to me.. Any thoughts? can you resend this question and include the contents of /etc/crontab as well? ~j -- Jonathan T. Sage Lighting Scenic Design Professional Web Design [HTTP://www.theatre.msu.edu] [EMAIL PROTECTED] [PGP: 182C CF3F 93A9 1DAA 2EBE D4D5 A159 96D9 452E A7F1] pgp0.pgp Description: PGP signature
Re: cron jobs
/etc/crontab 86%# /etc/crontab - root's crontab for FreeBSD # # $FreeBSD: src/etc/crontab,v 1.21.2.3 2000/12/08 10:56:07 obrien Exp $ # SHELL=/bin/sh PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin HOME=/var/log # #minute hourmdaymonth wdaywho command # */1 * * * * root/usr/libexec/atrun # # rotate log files every hour, if necessary 0 * * * * rootnewsyslog # # do daily/weekly/monthly maintenance 1 3 * * * rootperiodic daily 15 4 * * 6 rootperiodic weekly 30 5 1 * * rootperiodic monthly # # time zone change adjustment for wall cmos clock, # does nothing, if you have UTC cmos clock. # See adjkerntz(8) for details. 1,310-5 * * * rootadjkerntz -a */1 * * * * /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg - Original Message - From: Jonathan T. Sage [EMAIL PROTECTED] To: shawn [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, December 25, 2003 10:23 AM Subject: Re: cron jobs ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: cron jobs
shawn wrote: *snip* 1,310-5 * * * rootadjkerntz -a */1 * * * * /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg Part of your problem is going to be right here. comparing two lines, you will notice the the 6th field is the user to run the program/script as. This differs from an individual crontab. add the proper username and give it a shot. Hit us up with another e-mail if problems persist. Hope this helps, happy holidays ~j -- Jonathan T. Sage Lighting Scenic Design Professional Web Design [HTTP://www.theatre.msu.edu] [EMAIL PROTECTED] [PGP: 182C CF3F 93A9 1DAA 2EBE D4D5 A159 96D9 452E A7F1] pgp0.pgp Description: PGP signature