Unix Shell - Run in a 30 day increment from now

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > May 2007 > Run in a 30 day increment from now





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Run in a 30 day increment from now
sil

2007-05-21, 7:22 am

Hey all... Before trying to reinvent wheels, does anyone have a script
to do more or less the following:

logic:
if [ today = 05/21/2007 ]
then
run this script (using at) incremented 30 days from now
fi

I don't need it to run on the 30th day of the month (s'what cron is
for) just once in 30 days from the current date. (Thanks in advance
before I forget)...

Casper H.S. Dik

2007-05-21, 7:22 am

sil <dsphunxion@gmail.com> writes:

>Hey all... Before trying to reinvent wheels, does anyone have a script
>to do more or less the following:


>logic:
>if [ today = 05/21/2007 ]
> then
> run this script (using at) incremented 30 days from now
> fi


>I don't need it to run on the 30th day of the month (s'what cron is
>for) just once in 30 days from the current date. (Thanks in advance
>before I forget)...



% at now + 30 days
at> echo And 30 days on
at> <EOT>
job 1182341860.a at Wed Jun 20 14:17:40 2007

Also possible things as "time + 30 days" (note that this will give you 30
days from the next occurence of time and if you schedule a job at
noon every 30 days, you'd probably need to reschedule using
"at noon + 29 days" though it appears to give some slack.
(rounds down to whole minutes first)

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
Guillaume Dargaud

2007-05-22, 7:18 am

A bit offtopic, but for people who need to manipulate dates from scripts,
I've written a bunch of std C and sh utilities a long time ago and use them
regularly: http://www.gdargaud.net/Hack/SourceCode.html#StrfTime
In particular it can compute dates in the future.
--
Guillaume Dargaud
http://www.gdargaud.net/


chris.l.bryant@gmail.com

2007-05-22, 1:25 pm

On May 21, 6:37 am, sil <dsphunx...@gmail.com> wrote:
> Hey all... Before trying to reinvent wheels, does anyone have a script
> to do more or less the following:
>
> logic:
> if [ today = 05/21/2007 ]
> then
> run this script (using at) incremented 30 days from now
> fi
>
> I don't need it to run on the 30th day of the month (s'what cron is
> for) just once in 30 days from the current date. (Thanks in advance
> before I forget)...


sil

you might try "at -f script now + 43200 minutes" 43200 minutes is
equal to 30 days.

hth,

CB

Robert Bonomi

2007-05-30, 7:20 pm

In article <1179747472.952250.253170@n15g2000prd.googlegroups.com>,
sil <dsphunxion@gmail.com> wrote:
>Hey all... Before trying to reinvent wheels, does anyone have a script
>to do more or less the following:
>
>logic:
>if [ today = 05/21/2007 ]
> then
> run this script (using at) incremented 30 days from now
> fi
>
>I don't need it to run on the 30th day of the month (s'what cron is
>for) just once in 30 days from the current date. (Thanks in advance
>before I forget)...
>


Any of the following will work :
'at now + 2 fortnights + 2 days <furlong'
'at now + 4 weeks + 2 days <furlong'
'at now + 30 days <furlong'
'at now + 7200 hrs <furlong'
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com