----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 09, 2003 9:05 PM
Subject: [plug] Cron
> Anyone,
>
> How can we convert "0 minutes of the 1st hour on the third day no matter
what
> month and day of the week it falls on" or "every 1st hour on every third
day"
> into cron statement.
by cron's default capability, it is not capable... even if you use the
*step* feature as what the example shows below:
0 1 */3 * * /path/script.sh
or its expanded version
0 1 1,4,7,10,13,16,19,22,25,28,31 * * /path/script.sh
you will going to see the *bugs* there at the end of the day of the month...
but dont despair... ill give you a trick to solve your problem :-> so here
it is..
first, edit your cron file and enter this:
0 1 * * * /path/script.sh
it means that it will trigger your script.sh file every day of the first
hour...
second, put this inside your script.sh file:
#!/bin/sh
TIME=`date +%s`
if [ $(($TIME / 86400 % 3)) -eq 0 ]; then
echo "put your code here"
fi
it means that, the TIME variable is assigned number of seconds of time of
the day since epoch time, divided by or integer division of 86400 (because
there is 86400 seconds in one day) and modulus it by 3 (for 3 days)... if
the result is zero (-eq 0) then it means that it is the 3rd day again since
epoch time :-> therefore it will execute the "THEN" statement and put your
intended command in there... enjoy the code :->
fooler.
--
Philippine Linux Users' Group (PLUG) Mailing List
[EMAIL PROTECTED] (#PLUG @ irc.free.net.ph)
Official Website: http://plug.linux.org.ph
Searchable Archives: http://marc.free.net.ph
.
To leave, go to http://lists.q-linux.com/mailman/listinfo/plug
.
Are you a Linux newbie? To join the newbie list, go to
http://lists.q-linux.com/mailman/listinfo/ph-linux-newbie