Im Jake Posted May 25, 2008 Share Posted May 25, 2008 Well, I was wondering if anyone had a simple script that made backups of my database which would be runefant_rf and put the backups with the date in a folder called backups. and it made 1 backup at the end of each day Link to comment https://forums.phpfreaks.com/topic/107145-a-simple-script-for-backups/ Share on other sites More sharing options...
phpSensei Posted May 25, 2008 Share Posted May 25, 2008 Heres a simple way to do it. mysqldump -ce --user=username --password=password dbname | gzip | uuencode dbbackup_e.gz | mail [email protected] Chaneg the dbbackup_e.giz to a time(); format, use mkdir and name it the time(); format, and move the renamed file to your backup folder. or like this $backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz'; $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile"; system($command); Link to comment https://forums.phpfreaks.com/topic/107145-a-simple-script-for-backups/#findComment-549329 Share on other sites More sharing options...
Im Jake Posted May 25, 2008 Author Share Posted May 25, 2008 <? $dbhost = "localhost"; $dbuser = "runefant"; $dbpass = "pass here"; $dbname = "runefant_rf"; $backupfile = "backup"; $backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz'; $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile"; system($command); echo "Success!!!"; ?> thats my total code and its not making a backup Link to comment https://forums.phpfreaks.com/topic/107145-a-simple-script-for-backups/#findComment-549336 Share on other sites More sharing options...
Cory94bailly Posted May 25, 2008 Share Posted May 25, 2008 Was just working with him.. Here's the file: <? $dbhost = "localhost"; $dbuser = "runefant"; $dbpass = ""; $dbname = "runefant_rf"; $backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz'; $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile"; system($command); echo "Success!!!"; ?> He's getting the echo Success!!! but the file is not being made. Link to comment https://forums.phpfreaks.com/topic/107145-a-simple-script-for-backups/#findComment-549338 Share on other sites More sharing options...
Im Jake Posted May 25, 2008 Author Share Posted May 25, 2008 uhm, anyone? Link to comment https://forums.phpfreaks.com/topic/107145-a-simple-script-for-backups/#findComment-549513 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.