Cron, > 1 month but < 2 months
Hi,
Is there any easy way to schedule a job for a duration that is greater than one month but shorter than 2 months? Any duration will do, as long as it is easy to schedule. Thanks -- Tong (remove underscore(s) to reply) http://xpt.sourceforge.net/techdocs/ http://xpt.sourceforge.net/tools/ -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: jjc3a3$nd1$2@dough.gmane.org">http://lists.debian.org/jjc3a3$nd1$2@dough.gmane.org |
Cron, > 1 month but < 2 months
Hello there,
On Fri, Mar 09, 2012 at 05:09:23AM +0000, T o n g wrote: > Is there any easy way to schedule a job for a duration that is greater > than one month but shorter than 2 months? Any duration will do, as long > as it is easy to schedule. Easy? Hmmm. 0 12 * * 1 [ $(expr $(/bin/date +\%s) / 60 / 60 / 24 / 7 \% 8) -eq 3 ] && myscript works for me well enough: runs every Monday at noon and checks whether another eight weeks have passed, and if so executes myscript. By adjusting the -eq 3 the starting date for the eight week interval can be shifted around. HTH, Flo -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: 20120309083201.GA3477@fernst.no-ip.org">http://lists.debian.org/20120309083201.GA3477@fernst.no-ip.org |
Cron, > 1 month but < 2 months
Florian Ernst:
> Hello there, > > On Fri, Mar 09, 2012 at 05:09:23AM +0000, T o n g wrote: >> Is there any easy way to schedule a job for a duration that is greater >> than one month but shorter than 2 months? Any duration will do, as long >> as it is easy to schedule. > > Easy? Hmmm. > > 0 12 * * 1 [ $(expr $(/bin/date +\%s) / 60 / 60 / 24 / 7 \% 8) -eq 3 ] && myscript Nice. Is there any reason why you don't use "date '+%V'" (or %W or %U)? J. -- I start many things but I have yet to finish a single one. [Agree] [Disagree] <http://www.slowlydownward.com/NODATA/data_enter2.html> |
Cron, > 1 month but < 2 months
On Fri, Mar 09, 2012 at 12:08:38PM +0100, Jochen Spieker wrote:
> Florian Ernst: > > On Fri, Mar 09, 2012 at 05:09:23AM +0000, T o n g wrote: > >> Is there any easy way to schedule a job for a duration that is greater > >> than one month but shorter than 2 months? Any duration will do, as long > >> as it is easy to schedule. > > > > Easy? Hmmm. > > > > 0 12 * * 1 [ $(expr $(/bin/date +\%s) / 60 / 60 / 24 / 7 \% 8) -eq 3 ] && myscript > > Nice. Oops, forgot to paste the trailing ... || /bin/true which keeps newer cron from reporting the job as failed whenever [ ... ] doesn't exit successfully. > Is there any reason why you don't use "date '+%V'" (or %W or %U)? That'd break with every new year: for instance, [ $(expr $(/bin/date +\%V) \% 8) -eq 1 ] would trigger on ISO week 1, 9, ..., 41, 49 and then again in the next year on ISO week 1, resulting in a shorter interval "between" the years than desired. Cheers, Flo |
Cron, > 1 month but < 2 months
On Fri, 9 Mar 2012 12:08:38 +0100, Jochen wrote in message
<20120309110838.GN11891@wasteland.homelinux.net> : > Florian Ernst: > > Hello there, > > > > On Fri, Mar 09, 2012 at 05:09:23AM +0000, T o n g wrote: > >> Is there any easy way to schedule a job for a duration that is > >> greater than one month but shorter than 2 months? Any duration > >> will do, as long as it is easy to schedule. > > > > Easy? Hmmm. > > > > 0 12 * * 1 [ $(expr $(/bin/date +\%s) / 60 / 60 / 24 / 7 \% 8) -eq > > 3 ] && myscript > > Nice. Is there any reason why you don't use "date '+%V'" (or %W or > %U)? ..or maybe ddate? Tong, ddate uses 5 "seasons" with 73 days in each, should fit your purpose: arnt@nb6:~$ date &&ddate Fri Mar 9 15:25:34 CET 2012 Today is Pungenday, the 68th day of Chaos in the YOLD 3178 arnt@nb6:~$ ddate 14 3 2012 Pungenday, Chaos 73, 3178 YOLD arnt@nb6:~$ ddate 15 3 2012 Prickle-Prickle, Discord 1, 3178 YOLD arnt@nb6:~$ -- ..med vennlig hilsen = with Kind Regards from Arnt Karlsen ...with a number of polar bear hunters in his ancestry... Scenarios always come in sets of three: best case, worst case, and just in case. -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: 20120309153522.6e0f2195@nb6.lan">http://lists.debian.org/20120309153522.6e0f2195@nb6.lan |
Cron, > 1 month but < 2 months
On Fri, 09 Mar 2012 05:09:23 +0000, T o n g wrote:
> Is there any easy way to schedule a job for a duration that is greater > than one month but shorter than 2 months? Any duration will do, as long > as it is easy to schedule. Mmm... I wonder if using steps values (*/*) in crontab could be possible set a period of 45 days, that is, a task to be run every month and every 15 days :-? Greetings, -- Camaleón -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: jjdihf$f1t$12@dough.gmane.org">http://lists.debian.org/jjdihf$f1t$12@dough.gmane.org |
Cron, > 1 month but < 2 months
On Fri, Mar 9, 2012 at 12:35 PM, Camaleón <noelamac@gmail.com> wrote:
> On Fri, 09 Mar 2012 05:09:23 +0000, T o n g wrote: > >> Is there any easy way to schedule a job for a duration that is greater >> than one month but shorter than 2 months? Any duration will do, as long >> as it is easy to schedule. > > Mmm... I wonder if using steps values (*/*) in crontab could be possible > set a period of 45 days, that is, a task to be run every month and every > 15 days :-? According to this page[1], the following works for that: * * */45 * * your_scheduled_task I've not tried it myself. [1] http://stackoverflow.com/questions/8769689/set-cron-job-for-every-45-day-to-execute-my-php-script-using-cron -- Chris -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: CAOEVnYtw2HNatFsSF0uX5Xd8VV9t=8gfus0uC7y9+ArKtGxk+ g@mail.gmail.com">http://lists.debian.org/CAOEVnYtw2HNatFsSF0uX5Xd8VV9t=8gfus0uC7y9+ArKtGxk+ g@mail.gmail.com |
Cron, > 1 month but < 2 months
On Sun, 11 Mar 2012 01:42:25 -0600, Christofer C. Bell wrote:
> On Fri, Mar 9, 2012 at 12:35 PM, Camaleón <noelamac@gmail.com> wrote: >> On Fri, 09 Mar 2012 05:09:23 +0000, T o n g wrote: >> >>> Is there any easy way to schedule a job for a duration that is greater >>> than one month but shorter than 2 months? Any duration will do, as >>> long as it is easy to schedule. >> >> Mmm... I wonder if using steps values (*/*) in crontab could be >> possible set a period of 45 days, that is, a task to be run every month >> and every 15 days :-? > > According to this page[1], the following works for that: > > * * */45 * * your_scheduled_task > > I've not tried it myself. > > [1] > http://stackoverflow.com/questions/8769689/set-cron-job-for-every-45-day-to-execute-my-php-script-using-cron Mmm, interesting! I was thinking in using a combination of days and months (this is completely untested just an idea): * * */15 */1 * #task to run Mainly because "man 5 crontab" says you can only use a range between 1-31 for days and 1-12 for months but if that works it would be great :-) Greetings, -- Camaleón -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: jji7gc$jrs$3@dough.gmane.org">http://lists.debian.org/jji7gc$jrs$3@dough.gmane.org |
Cron, > 1 month but < 2 months
>> On Sun, 11 Mar 2012 01:42:25 -0600, Christofer C. Bell wrote:
C> According to this page[1], the following works for that: C> * * */45 * * your_scheduled_task C> I've not tried it myself. I'd use a timestamp file in conjunction with find; what happens when your 45-day interval crosses Jan 1st? For example: me% date Sun Mar 11 21:51:21 EDT 2012 me% touch -d '45 days ago' timestamp me% ls -l --time-style='+%d-%b-%Y %T' timestamp -rw-r--r-- 1 me me 0 26-Jan-2012 20:51:27 timestamp me% find timestamp -daystart -mtime +1 -print timestamp me% find timestamp -daystart -mtime +44 -print timestamp me% find timestamp -daystart -mtime +45 -print # no output Run something like this every day: #!/bin/bash ts=/time/stamp/file interval=45 set X $(find $ts -daystart -mtime +$interval -print) shift case "$#" in 0) logger 'starting' ;; *) logger 'skipping'; exit 0 ;; esac # run your php script or whatever ... touch $ts Another advantage: you can decide whether to "touch $ts" based on the return code from whatever you're trying to run. If it fails, do you want to alert someone and run it tomorrow or wait another 45 days? Reschedule by setting the $ts modtime instead of dorking around with cron. -- Karl Vogel I don't speak for the USAF or my company Bumper-sticker on Mel Gibson's car: "Swerve If You Love Jesus" -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: 20120312021336.658D0BFBE@kev.msw.wpafb.af.mil">htt p://lists.debian.org/20120312021336.658D0BFBE@kev.msw.wpafb.af.mil |
Cron, > 1 month but < 2 months
On Fri, Mar 09, 2012 at 03:35:22PM +0100, Arnt Karlsen wrote:
[..] > arnt@nb6:~$ date &&ddate > Fri Mar 9 15:25:34 CET 2012 > Today is Pungenday, the 68th day of Chaos in the YOLD 3178 > arnt@nb6:~$ ddate 14 3 2012 > Pungenday, Chaos 73, 3178 YOLD > arnt@nb6:~$ ddate 15 3 2012 > Prickle-Prickle, Discord 1, 3178 YOLD > arnt@nb6:~$ root@tal:~# apt-cache show ddate N: Unable to locate package ddate E: No packages found root@tal:~# apt-cache search ddate postgresql-contrib-8.4 - additional facilities for PostgreSQL postgresql-contrib-9.1 - additional facilities for PostgreSQL root@tal:~# -- "Religion is excellent stuff for keeping common people quiet." -- Napoleon Bonaparte -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: 20120313033236.GA1971@tal">http://lists.debian.org/20120313033236.GA1971@tal |
| All times are GMT. The time now is 09:17 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.