보통 crontab -e 명령어를 통해서 작업을 하다보면, 다음과 같은 에러가 난다.
crontab: installing new crontab
"/tmp/crontab.XXXXScNhd2":3: bad minute
errors in crontab file, can't install.
Do you want to retry the same edit?
그 이유는 다음과 같다.
문법에 맞는 cron 스타일로 입력하지 않았기 때문에 그런 에러가 나는 것이다.
또는 dos에서 사용되는 ^M$가 라인 뒤에 붙어 있어서 문제가 될 수 도 있다..
* 참고
http://www.linuxboxadmin.com/micro/micro-how%11tos/system-administration/crontab.html
Crontab fields
Here is how the fields are defined:
- minute
- hour
- day of the month
- month of the year
- day of the week
- program or command to run
An asterisk (*) in any field means run every time for this field. Ranges (X-Y) and steps (X-Y/Z) can also be defined.
User crontabs
To edit a user crontab (including root):crontab -e
To delete a crontab:crontab -r
System crontab
The system crontab is stored in /etc/crontab. It can be changed (as root) with a text editor.
The system crontab has one extra field before the program to run, which is the user to run the command as (usually root).
Error installing new crontab (bad minute)
I've received this cryptic error message while trying to update a crontab:
crontab: installing new crontab "/tmp/crontab.XXXXScNhd2":3: bad minute errors in crontab file, can't install. Do you want to retry the same edit?
The error message suggests a format problem with my entry, but the real error is due to DOS line endings (CR LF) in the file. Unix/Linux line endings just use CR. If a crontab is installed without using the crontab -e
command, this error might appear.
You can check the line endings by running:cat -v -e -t /var/spool/cron/username
If you see "^M$" at the end of each line, the file has DOS line endings. Each line should just end with "$".
The fix is to run the dos2unix
command on the crontab to correct the line endings:dos2unix /var/spool/cron/username
'c or linux' 카테고리의 다른 글
쉘 스크립트에서의 함수 파라미터 (0) | 2007.09.11 |
---|---|
ulimit (0) | 2007.09.10 |
crontab 디렉토리 (0) | 2007.09.08 |
Authentication token is no longer valid (0) | 2007.09.07 |
<img src="http://blogimgs.naver.com/nblog/ico_scrap01.gif" class="i_scrap" width="50" height="15" alt="본문스크랩" /> [프로그래밍언어] perl (0) | 2007.08.15 |