Backup the file and mysql data to disk(php script)

// if you want auto backup data everyday or every week, you need add a cronjob. 
<?php
if($_GET['pass']=='testpass')
{
	$time	=	date('Y-m-d-H-i-s');
 
	// backup the data files
	system('tar -zcvf /var/data-backup/'.$time.'www.tar.gz /var/www');
 
	// backup the database
	system('mysqldump -u radius -pxxx radius >/var/data-backup/'.$time.'-radius.sql');	
 
}

Related posts:

Leave a Reply

Your email address will not be published.