Scheduled BACKUP Database
/usr/sbin/backupmysql
timestamp= ' date + '%y-%m-%d-%h-%m-%s '
Mysqldump-uroot-p ' 123456 databasename>/db$timestamp.sql
chmod +x Backupmysql
Install Crontab:
[email protected] ~]# Yum install Vixie-cron
[email protected] ~]# Yum install Crontabs
The first way
CRONTAB-E New timed Tasks
0 3 * * */usr/sbin/backupmysql
Crontab-l Show timed Tasks
Another way (you need to specify a running user)
[Email protected] dbbackup]# Vi/etc/crontab
Shell=/bin/bash
Path=/sbin:/bin:/usr/sbin:/usr/bin
Mailto=root
home=/
# for details see Mans 4 Crontabs
# Example of Job definition:
#.----------------Minute (0-59)
# | .-------------Hour (0-23)
# | | .----------Day of Month (1-31)
# | | | .-------month (1-12) OR jan,feb,mar,apr ...
# | | | | .----Day of Week (0-6) (sunday=0 or 7) or Sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * * user-name command to be executed
* * * * root/usr/sbin/backupmysql
Regular backup of MySQL database on Linux