if you have a shell account write a batch file and install it in the crontab
of the user whihc mysql runs under.

i did this at work for a postgresql database and it owrks perfectly.

something like this will work.

crontab -u <user> -e

add:
30 7-19/2,23 * * * /backup/dumpit

which runs /backup/dumpit every 2 hours  at 30 mins past the hour between
7am and 7 pm and then again at 11 pm

dumpit consists of:

#!/bin/sh
backdate=$(date +%Y%m%d%H%M.gz)
/usr/local/pgsql/bin/pg_dump XXX  | gzip > /backup/edb-backup_$backdate
cp /backup/edb-backup_$backdate /var/autofs/misc/ecalnet/

so i effect the file creates a file called edb-backup_<date and time> which
is a zipped copy of the dump file.

should be simple for you to substitute the mysql dump commands etc.

Steve




<[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi I'm trying to create a script which my cron will run once a day to
backup
> my MySQL database, but the exec command doesn't want to work no matter
what I
> try...
>
> exec("mysqldump -h localhost -u user -p pass --opt DataBase >
> BACKUPS/backup.mysql") or die("Problem");
>
> I have tried adding the full path to mysqldump, I have tried using my root
> access, I have tried using a different dir to store the files, changed
> permissions all sorts and nothing works. It always returns "Problem" and
if I
> take out the or die then it just returns a blank screen. I also tried
system
> () and that gave the same results.
>
> Anyone have any other ideas???
>
> TIA
>
>
> __________________
> -Ade
>
> ~~Good things come to those who wait~~



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to