1. First, add the scheduled task to the list. The system scans the task list every minute to check whether the task is to be executed at the current time./etc/crontab: # mhdommondowusercommand01 ** & n
1. First, add the scheduled task to the list. The system scans the task list every minute to check whether the task is to be executed at the current time.
- /etc/crontab:
- # m h dom mon dow user command
- 0 1 * * * root /home/fzw/db.sh
- 0 2 * * * root /home/fzw/auto.sh
M: minute h: hour dom: day of month mon: month dow: day of week user: user command: Task command
2./Home/fzw/db. shBackup, compression
- mysqldump -x -u root -h 127.0.0.1 -p 123 -c --hex-blob --default-character-set=utf8 --compact --no-create-db --no-create-info --databases dbname > /home/fzw/136/136_4d`date +%Y%m%d`.sql
- rar a /home/fzw/136/136_4d`date +%Y%m%d`.rar /home/fzw/136/136_4d`date +%Y%m%d`.sql
3./Home/fzw/auto. shCopy192.168.2.143
- #!/usr/bin/expect -f
- set date [exec date +%Y%m%d]
- set password 123
- spawn scp /home/fzw/136/136_4d$date.rar fzwadmin@192.168.2.143:/home/fzwadmin/136/136_4d$date.rar
- set timeout 300
- expect "fzwadmin@192.168.2.143's password:"
- send "$password\r"
- expect eof
- #interact