FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Cron Jobs (AutoBackup for all MYSQL databases every 24h)

 


phx777
this should work right?

Code:

DBPASS=pass
DBUSER=user
EMAIL="me@my.net"
FILENAME=MySQL

mysqldump -u $DBUSER -p$DBPASS --all-databases > backup.sql
gzip backup.sql
DATE=`date +%Y%m%d` ; mv backup.sql.gz $FILENAME-backup-$DATE.sql.gz
echo 'Blog Name:Your mySQL Backup is attached' | mutt -a $FILENAME-backup-$DATE.sql.gz $EMAIL -s "MySQL Backup"
rm $FILENAME-backup-$DATE.sql.gz


i feel like installing linux again just so i can fool around in konsole with transparent background Razz
phx777
but let me guess, mutt isnt installed on the server? Razz
does anyone have any good idea how i could send myself my backup to mail after i store it on server...
kv
Easy! Use php mail() function. In the php.net mail manual, there is a utility class to send attachments posted by somebody.

http://us2.php.net/function.mail
n0obie4life
Please, not every 24 hours. Maybe once a week..!

http://www.phpbb.com/kb/article.php?article_id=123

Try reading that (it's the phpbb website, but if you use a little bit of brains, it works for all databases)
Aelita
haha I guess if you just freaked about the once a day saving it's not a good idea to save every 6 hours huh...? Lol okay okay i wont... AND DON"T BOTHER CHECKING I HAVEN'T SET IT UP YET Razz *Runs to disable...* J/K
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.