Cron 작업이 적절한 설정 후에도 실행되지 않습니다.

Cron 작업이 적절한 설정 후에도 실행되지 않습니다.

그래서 아래와 같이 cron 작업을 만들었습니다.

  GNU nano 2.2.6                    File: /tmp/crontab.uNoEXy/crontab

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
*/3 *  *    *   *    /home/kyle/runBackup.sh

테스트를 위해 3분마다 표시된 대로 스크립트를 실행합니다. 예, 확인 중 var/log/syslog입니다. 오늘은 크론 실행이 없습니다. 이 크론이 실행되고 있다는 증거는 .tar.gz내 보관용 폴더에 있는 파일입니다. 스크립트를 직접 실행하면 이 파일이 발생합니다. 아무 일도 일어나지 않는 것은 단지 그것을 cron에 넣는 것뿐입니다.

답변1

다음을 사용해 보세요:

*/3 * * * * /home/kyle/runBackup.sh

CRON 표현식은 5개 또는공백으로 구분된 6개 필드

자세한 내용은 다음을 참조하세요.http://en.wikipedia.org/wiki/Cron

답변2

나는 매우 비슷한 문제가 있었고 작업 실행이 예약된 후 루트에 대해 메일이 /var/spool/mail에 배치되고 있다는 것을 알았습니다. 루트 사용자는 작업이 배치된 루트 crontab입니다. 작업을 실행할 수 있는 권한이 있습니다. 좀 둘러보았더니 대상 스크립트가 실행 가능하지 않기 때문인 것으로 밝혀졌습니다. 그렇게 하는 경우:

ls -la /home/kyle/

runBackup.sh에 -rw-r--r-- 권한이 표시되면 다음을 시도해 보세요.

chmod +x /home/kyle/runBackup.sh

-rwxr-xr-x 권한을 부여하고 작업 실행을 허용해야 합니다.

소스 자료

관련 정보