내 crontab에 cron이 있습니다
45 18 * * * root /bkp_db.sh
하지만 작동하지 않습니다. 구현되지 않았습니다. 내가 뭘 잘못했나요?
내 스크립트에서:
NOW=$(date +"%Y-%m-%d")
mysqldump -u root apps_db > bkp_apps/dump_app1_$NOW.sql
mysqldump -u root app_db2 > bkp_apps/dump_app2_$NOW.sql
zip -r bkp_apps/bkp_apps_$NOW.zip /var/www/myapps/public_html
답변1
개인 crontab 파일은 다음과 같아야 합니다
45 18 * * * /bkp_db.sh
여러 개의 crontab 파일이 있으며 각각 약간씩 다른 레이아웃을 가지고 있습니다. 편집된 개인 crontab 파일에는 crontab -e
사용자 이름이 포함되어 있지 않습니다.
man crontab
설명하다,
There is one file for each user's crontab under the
/var/spool/cron/crontabs directory. Users are not allowed to edit the
files under that directory directly to ensure that only users allowed by
the system to run periodic tasks can add them, and only syntactically cor‐
rect crontabs will be written there. This is enforced by having the
directory writable only by the crontab group and configuring crontab com‐
mand with the setgid bid set for that specific group.
하지만 읽으면 man cron
읽게 될 것입니다.
Additionally, in Debian, cron reads the files in the /etc/cron.d direc‐
tory. cron treats the files in /etc/cron.d as in the same way as the
/etc/crontab file (they follow the special format of that file, i.e. they
include the user field). However, they are independent of /etc/crontab:
they do not, for example, inherit environment variable settings from it.
This change is specific to Debian see the note under DEBIAN SPECIFIC
below.