Iklekid Posted March 6, 2003 Share Posted March 6, 2003 Hi I would like to make a back up of my websites myswl databse everyday at midnight! I have been told that I can do this using a crontab! I have crontabs on my server but I dont know what coding/command line on the cron tab to use! There is only one databse I would like to back up! Anyoen know how to do this? Thanks in advance for any help! Iklekid Quote Link to comment Share on other sites More sharing options...
Iklekid Posted March 8, 2003 Author Share Posted March 8, 2003 Anyone know how to do this? I could really do with having an automatic backup Quote Link to comment Share on other sites More sharing options...
dgwade Posted March 8, 2003 Share Posted March 8, 2003 I was just looking for this today. I found a site on Lycos that is pretty helpful: http://howto.lycos.com/lycos/topic/1,,9+47...7+26093,00.html There are pages here on using crontab to run a backup script every so often. Quote Link to comment Share on other sites More sharing options...
Iklekid Posted March 9, 2003 Author Share Posted March 9, 2003 thanks I will go and look Quote Link to comment Share on other sites More sharing options...
phpfreak Posted March 9, 2003 Share Posted March 9, 2003 You could use my Backup Utility: http://www.phpfreaks.com/script/view/11.php Alternatively, I would create a PHP script to do this. Something like this: [php:1:6356097178]<?php $filename = \"mysqldb\".time().\".sql\"; passthru(\"mysqldump -u (username) -p(password) --opt (database_name) > /my/backup/directory/$filename\"); ?>[/php:1:6356097178] Then using my PHP CRON Tutorial, you can set it up on a CRON TAB. http://www.phpfreaks.com/tutorials/28/0.php Good luck. Quote Link to comment Share on other sites More sharing options...
Iklekid Posted March 9, 2003 Author Share Posted March 9, 2003 <?php $filename = \\\"mysqldb\\\".time().\\\".sql\\\"; passthru(\\\"mysqldump -u (username) -p(password) --opt (database_name) > /my/backup/directory/$filename\\\"); ?> Do i replace the /my/backup/directory with my full server path to a folder I would like the backups put into?? And also do i jsut do a wget fucntion in the cron tab command? Thanks Iklekid Quote Link to comment Share on other sites More sharing options...
phpfreak Posted March 9, 2003 Share Posted March 9, 2003 Yes, common sense to me would tell me to replace that path to the directory where I want the backup to be stored. Also, please read the tutorial for the cron tab. It tells you how to use a CGI version of PHP as well as lynx to access your php script. Thanks, Quote Link to comment Share on other sites More sharing options...
Iklekid Posted March 10, 2003 Author Share Posted March 10, 2003 Hi I am using the script U have created but it dosent seem to want to work! I have a cron tab set to wrok at midnight the cron command is php /home/dwog/public_html/*****/dbsender.php > dev/nul I am asking for it to email me the fille, I have chmod the directory but still no luck. Any ideas? Thanks Quote Link to comment 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.