Cronjob이 작동하지 않지만 명령은 작동합니다.

Cronjob이 작동하지 않지만 명령은 작동합니다.

cronjob 목록에서 명령을 실행해야 합니다. 하나는 mysql 백업용이고 다른 하나는 디렉터리 cp 명령용입니다.

명령을 실행하면 작동합니다. 하지만 다음 명령을 실행하면 오류가 발생합니다.

run-parts /etc/cron.daily

실수:

cp: cannot create regular file 'dpkg.status': Permission denied
touch: cannot touch 'dpkg.status': Permission denied
savelog: could not touch dpkg.status
cp: cannot create regular file 'dpkg.diversions': Permission denied
touch: cannot touch 'dpkg.diversions': Permission denied
savelog: could not touch dpkg.diversions
cp: cannot create regular file 'dpkg.statoverride': Permission denied
touch: cannot touch 'dpkg.statoverride': Permission denied
savelog: could not touch dpkg.statoverride
/etc/cron.daily/logrotate: 6: /etc/cron.daily/logrotate: cannot create status.clean: Permission denied
/etc/cron.daily/logrotate: 7: /etc/cron.daily/logrotate: cannot create status.clean: Permission denied
mv: cannot stat 'status.clean': No such file or directory
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error creating output file /var/lib/logrotate/status.tmp: Permission denied
run-parts: /etc/cron.daily/logrotate exited with return code 1
start-stop-daemon: unable to set gid to 12 (Operation not permitted)
run-parts: /etc/cron.daily/man-db exited with return code 2
flock: cannot open lock file /run/mlocate.daily.lock: Permission denied
run-parts: /etc/cron.daily/mlocate exited with return code 66
cp: cannot create regular file 'passwd.bak': Permission denied
cp: cannot create regular file 'group.bak': Permission denied
cp: cannot open '/etc/shadow' for reading: Permission denied
cp: cannot open '/etc/gshadow' for reading: Permission denied
run-parts: /etc/cron.daily/passwd exited with return code 1

내 크로나:

0 6 * * * zip -rj /home/dan/Dropbox/$(date '+%Y%m%d%H%M%S')_bk.zip /home/dan/dan_portfolio/src/
0 6 * * * mysqldump -u 'danport' -p'I_CHANGE_THIS' danport_db > /home/dan/Dropbox/$(date '+%Y%m%d%H%M%S')_db.sql

답변1

탈출 날짜가 내 문제를 해결했습니다.

\%Y\%m\%d\%H\%M\%S

관련 정보