Click to See Complete Forum and Search --> : Midnight Backups


syrocax
08-19-2002, 10:11 PM
I don't have much experience in PHP. But it would be neat to have a script for scheduled backups, I tought.
Script is OK. But how to run it automaticly if possible?

I am working on a rented space supporting PHP 4 operated by linux...

I couldn't come up with anything instead of configuring the script to run by a button and then setting the alarm-clock :)

jstarkey
08-19-2002, 10:18 PM
Log into the server via telnet or ssh and type:

crontab -e

Move to a blank line, then type:

i

and:

05 * * * * /path/to/the/script

then:

ZZ

(this is all assuming you have vi set as your editor.)

The 05... tells cron to run the job 5 mins after midnight, each night.

syrocax
08-19-2002, 10:27 PM
Thank you. You have another happy coder now...

Sxooter
08-20-2002, 05:10 AM
Actually, that line should be 5 0 * * * for the crontab. The one there runs 5 minutes after every hour. Also useful, but probably not exactly what you need at noon under load.

Do 'man 5 crontab' to get a listing of all the configuration settings for crontab. also, look at the /etc/crontab on a redhat or similar box to see what time root runs so you aren't competing too much for CPU/IO when you do your cron jobs.

jstarkey
08-21-2002, 03:00 AM
Yep, sorry. Was thinking in another timeframe :)

Another good way to do backups is to put a script in /etc/cron.daily and it will be executed each day. This way, you just drop the script in the folder and it will be executed in turn.

teddyjas
08-22-2002, 12:28 AM
i'm using the following crontab to do my daily reports run at midnight:
0 0 * * * php report.php >/dev/null

:) maybe it helps