From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 Description of problem: We are seeing a strange behaviour in cron where it will fail to run jobs, log that the job wasn't run, and continue normally. However, the log offers no good hint as to why it is occurring. I will attach the proper items to give further guidance, but the log simply states "UNSAFE". Version-Release number of selected component (if applicable): vixie-cron-4.1-19 How reproducible: Always Steps to Reproduce: 1. Create a normal user (in our example, iom_user). 2. Create a script that does some stuff (ps, ls, kill, whatever). 3. Create a cron entry to run the script. Actual Results: The job never ran, and logged the following message: Feb 9 17:55:01 zinc-inst crond[24812]: (iom_user) CMD (/users/iom_user/bea/user_projects/domains/iom_domain/scripts/wrapper.sh /users/iom_user/bea/user_projects/domains/iom_domain/scripts/stopIOM.sh /home/iom_user/iom_order_deploy/) Feb 9 17:55:01 zinc-inst crond[24811]: (iom_user) UNSAFE (iom_user) The wrapper.sh script just exec's $* in an attempt to fix this problem. (It failed, obviously.) Expected Results: The script should have run, and I should have noted a log entry showing success. Additional info:
Created attachment 110902 [details] Wrapper script, which is the entry cron calls. This is the wrapper.sh script that is called in the cron entry shown in the bug body.
Created attachment 110903 [details] The script that wrapper.sh eventually executes to run the user job. wrapper.sh calls this script (as shown in the cron entry), which is what does the actual work.
CRON refuses to run any job from a file that contains illegal characters, so the file I need to see is /var/spool/cron/iom_user to tell you exectly why it is rejected. Yes, CRON's error messages on rejecting CRON jobs have always been singularly unhelpful - there is no easy way to fix this without fairly major code changes, which would not have been acceptable for RHEL-4 - lack of error messages is legacy cron behaviour, and I hope to have an enhanced CRON with good error messages through QA by RHEL-4-U2 . CRON considers a file UNSAFE that contains any characters not in this set will reject any crontab file containing them : [\n@!:%-.,:alnum::print:] see man tr(1) for exact meaning of this character class set. Note that \r (CR, ^M) is NOT a member of this set, so if /var/spool/cron/iom_user contains MS-DOS style CRLF line endings, it will be rejected - see man dos2unix(1) .
The full crontab entry, as requested: 32 18 * * 0- 6 /users/iom_user/bea/user_projects/domains/iom_domain/scripts/wrapper .sh /users/iom_user/bea/user_projects/domains/iom_domain/scripts/stopI OM.sh /home/iom_user/iom_order_deploy/
Carl, probably would be best to attach it as an attachment so that Bugzilla doesn't screw up the formatting. As it currently stands, it looks like you have CR at the end of every line, and I don't expect that's really the way it is in your file.
Yes, please attach the complete file as an attachment. Alternatively, you could cut and paste the output of this command into the bug: # od -c /var/spool/cron/iom_user
[root@zinc-inst ~]# od -c /var/spool/cron/iom_user 0000000 3 2 1 8 * * 0 - 6 / u 0000020 s e r s / i o m _ u s e r / b e 0000040 a / u s e r _ p r o j e c t s / 0000060 d o m a i n s / i o m _ d o m a 0000100 i n / s c r i p t s / w r a p p 0000120 e r . s h / u s e r s / i o m 0000140 _ u s e r / b e a / u s e r _ p 0000160 r o j e c t s / d o m a i n s / 0000200 i o m _ d o m a i n / s c r i p 0000220 t s / s t o p I O M . s h / h 0000240 o m e / i o m _ u s e r / i o m 0000260 _ o r d e r _ d e p l o y / \n 3 0000300 0 6 * * 1 - 5 / h o m 0000320 e / i o m _ u s e r / i o m _ o 0000340 r d e r _ d e p l o y / s c r i 0000360 p t s / s t a r t I O M . s h 0000400 / h o m e / i o m _ u s e r / i 0000420 o m _ o r d e r _ d e p l o y / 0000440 \n 0000441
I've attached the script, since the od came out pretty bad.
Created attachment 110950 [details] the cron file for iom_user
Created attachment 110951 [details] wrapper.sh - sent directly from the Linux system instead of Windows.
I finally have time to give this bug my full attention . Yes, Jay - you are right - the problem is that 'safe_delim' does not contain '_' . The job is actually executed , as shown by the crond[24812]: (iom_user) CMD (...) but its output is lost, because cron rejects the user name as being an invalid mail recipient user name. This seems very silly to me - sendmail is able to do its own validation of user names. I can understand attempting to strip unallowed binary chars from the output, as this could cause problems without proper mime encoding, but cron does not attempt to do this . The short-term workaround is to set 'MAILTO=iomuser' in iom_user's crontab, and to create an alias of iomuser for iom_user@localhost in /etc/mail/aliases . I'm now producing a fix, which will be to to disable mail recipient name validation unless the 'CRON_VALIDATE_MAILRCPTS' environment variable is set in /etc/sysconfig/crond, which I will try to get into RHEL-4-U1 .
This is now fixed in vixie-cron-4.1-22_EL, which is now making its way through QA into RHEL-4-U1 . Meanwhile, you can download it from: http://people.redhat.com/~jvdias/vixie-cron/RHEL-4
Thank you - it works. Better yet, your response time was phenomenal. Thany you again.
Adding to the U1 Blocker list.
*** Bug 168855 has been marked as a duplicate of this bug. ***
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2005-361.html