Quoting fooler <[EMAIL PROTECTED]>: > 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 :-> >
Thanks for your effort foller. I believed this will solve my problem. Actually, what I'm trying to solve is to have an Automatic Backup for our local database system that uses Postgresql as back-end. My idea is to use 'pg_dump' in order to have a daily snapshot (e.g. 20030611.sql) and will then be stored to a certain directory (e.g /tmp/pg_dump/200306). The monthly record will then be copied to a cd-rw. Again thanks. I am now, enlighted. Regards, Howard. Sulat @MU v.2.2 (Fresh) ....................................................................................... An extended module for MUWeb4 Project of Howard R. Bagcat Powered by GNU General Public License softwares. http://my.mu.edu.ph - a personalized portal is soon to come. -- 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
