To display current scheduler jobs listing
crontab -l
To add or edit the scheduler jobs
crontab -e
Backup
Using vi to create a shell script file to run at crontab scheduler
vi wwwbackup.sh
chmod 777 wwwbackup.sh /* change the script file to exexcutable */
#!/bin/sh
fn=`date +%Y%m%d`
mysqldump -hlocalhost -uUSERNAME -pPASSWORD DATABASE > /var/www/vhosts/yourdomain.com/private/backup/dbbackup_$fn.dump
tar cf /var/www/vhosts/yourdomain.com/private/backup/cscart/$fn.files /var/www/vhosts/yourdomain.com/httpdocs
Restore
mysql -u root DATABASE < dbbackup_yyyymmdd.dump
No comments:
Post a Comment