질문드립니다
현재 리눅스 crontab을 사용한 db 백업을 실행하려 하는데 실행이 되지 않아서 여쭤봅니다
현재
#vi /var/cron_backup/db_mysql_bak
#!/bin/bash
# sudo mkdir /var/backup/mysql_$(date +%Y%m%d)
# /usr/bin/mysqldump -uroot -proot -A > mysql_db_bak_$(date +%Y%m%d).sql
# mv *.sql /backup
/usr/bin/mysqldump -uroot -proot --events --ignore-table=mysql.event --all-databases > /home/tact2/db_mysql_test_$(`date + %Y%m%d`).sql
~
위와 같이 쉘 스크립트를 입력해 놓은 상태이며
./db_mysql_back.sh 로 쉘스크립트 실행시 제대로 db back up이 진행됩니다
헌데 crontab에 등록하여 작동시키면 작동이 되지 않습니다 log파일을 찾아보려해도 /etc/log에 cron관련한 log파일이 존재하지 않는 상태이며
crontab의 내용은 아래와 같습니다
#HOME=/
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
"crontab" [읽기 전용] 24L, 953C 1,1 꼭대기
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
#SHELL=/bin/sh
#PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/etc/cron.hourly;/
#HOME=/
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
*/1 * * * * tact2 run-parts /etc/cron.hourly/db_mysql_back.sh
#
현재 .sh파일은 cron.hourly에 있습니다 권한은 755로 주었습니다.
왜 실행이 되지 않는지 알고계시다면 조언 부탁드립니다. 감사합니다.
댓글 달기