For developer , It is most important to run the specific program for specific time of interval on local machine (localhost).
It can be done with the help of task scheduler
For Task schedular Go to the Start >> All programs >> Accessories >> System Tools >> Task Scheduler
Then click on Create Task
Fill all the details, please add the .bat file and complete the process.
Please specify the commands in to your .bat file.
In that .Bat file
D:\xampp\php\php.exe -f "D:\xampp\htdocs\mysqlbackup.php"
In mysqlbackup.php
$dbhost = "localhost"; // usually localhost
$dbuser = "root";
$dbpass = "";
$dbname = "Db_name";
$backupfile = 'E:/'.$dbname . date("Y-m-d") . 'todayDb.sql';
system("D:/xampp/mysql/bin/mysqldump.exe -h $dbhost -u $dbuser $dbname > $backupfile");
It can be done with the help of task scheduler
For Task schedular Go to the Start >> All programs >> Accessories >> System Tools >> Task Scheduler
Then click on Create Task
Fill all the details, please add the .bat file and complete the process.
Please specify the commands in to your .bat file.
In that .Bat file
D:\xampp\php\php.exe -f "D:\xampp\htdocs\mysqlbackup.php"
In mysqlbackup.php
$dbhost = "localhost"; // usually localhost
$dbuser = "root";
$dbpass = "";
$dbname = "Db_name";
$backupfile = 'E:/'.$dbname . date("Y-m-d") . 'todayDb.sql';
system("D:/xampp/mysql/bin/mysqldump.exe -h $dbhost -u $dbuser $dbname > $backupfile");
No comments:
Post a Comment