cgm225 Posted January 24, 2008 Share Posted January 24, 2008 I want to have a simple php function for backing up my MySQL database monthly. I have a function to backup the database (example below), but wanted to know if someone would help me with getting it to repeat monthly? <?php BackupDB () { $backupFile = date("Y-m-d-H-i-s") . '.sql'; system("mysqldump --user=username --password=password --host=mysql.internal --databases myDB username_email > /web/mysite.com/BACKUP/mysql/$backupFile"); } ?> Thank you all in advance! Quote Link to comment https://forums.phpfreaks.com/topic/87601-running-function-within-script-if-its-been-30days-since-last-execution/ Share on other sites More sharing options...
resago Posted January 24, 2008 Share Posted January 24, 2008 load a text file that has the last date executed compare against your limit if needed { run backup write to file the current date. } Quote Link to comment https://forums.phpfreaks.com/topic/87601-running-function-within-script-if-its-been-30days-since-last-execution/#findComment-448072 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.