Alright, I think I have it (I’m just waiting to make sure cron fires off and runs everything)! It’s very simple, and probably pretty dirty - but hey I’m not a whiz with shell scripting, nor cron so I think what I have is pretty sweet.
Because I’m lazy (I’m a programmer!) and I know I wouldn’t remember to run backups in an normal fashion, I wanted to make a system to run them automatically, think set it and forget it (wait wasn’t that an infomercial of some type?). So without further adieu…
The Shell script:
#!/bin/sh
export PATH=/usr/local/bin:/bin:/usr/bin
mysqldump --opt -uUsername -pPassword --all-databases >
~/db_backup_tmp/all-db-backup.sql &&
mv ~/db_backup_tmp/all-db-backup.sql ~/db_backup/all-db-backup.sql
The PHP script:
$file = "~/mysql_backup.sh";
exec($file);
Calm down, I’ll explain it…
So first we have the shell script.
#!/bin/sh
From Wiki

January 25, 2008
Posted in


content rss


Recent Comments