cron without sendmail generates bogus logfile names
Linus Hicks
linush100@gmail.com
Tue Sep 9 22:03:00 GMT 2008
The "poor man's mailer" included as part of the cron package uses the
following construct to generate part of the filename used in making
log file names:
DATE=$(date '+%Y%m%d_%H%M%S')
It then generates the filename as:
FILE="/tmp/cron.$DATE.$$.log"
However, it seems to be tacking on a CR character at the end of the
DATE portion which messes up the generated filenames. I cannot
reproduce this behavior in sh running in an xterm window:
oracle@ERPPRODDBS03 log $ DATE=$(date '+%Y%m%d_%H%M%S')
oracle@ERPPRODDBS03 log $ echo $DATE
20080909_170639
oracle@ERPPRODDBS03 log $ FILE="/tmp/cron.$DATE.$$.log"
oracle@ERPPRODDBS03 log $ echo $FILE
/tmp/cron.20080909_170639.6588.log
oracle@ERPPRODDBS03 log $ ls -l /usr/sbin/sendmail
lrwxrwxrwx 1 oracle None 16 Jul 3 15:00 /usr/sbin/sendmail -> /usr/bin/cronlog*
oracle@ERPPRODDBS03 log $
Here's a hexdump of the cron.log showing the spurious characters:
oracle@ERPPRODDBS03 log $ hexdump.exe -C cron.log
00000000 2f 75 73 72 2f 73 62 69 6e 2f 73 65 6e 64 6d 61 |/usr/sbin/sendma|
00000010 69 6c 3a 20 6c 69 6e 65 20 34 30 3a 20 2f 74 6d |il: line 40: /tm|
00000020 70 2f 63 72 6f 6e 2e 32 30 30 38 30 39 30 35 5f |p/cron.20080905_|
00000030 32 33 35 35 30 32 0d 2e 34 35 39 36 2e 6c 6f 67 |235502..4596.log|
00000040 3a 20 4e 6f 20 73 75 63 68 20 66 69 6c 65 20 6f |: No such file o|
00000050 72 20 64 69 72 65 63 74 6f 72 79 0a 2f 75 73 72 |r directory./usr|
00000060 2f 73 62 69 6e 2f 73 65 6e 64 6d 61 69 6c 3a 20 |/sbin/sendmail: |
00000070 6c 69 6e 65 20 34 30 3a 20 2f 74 6d 70 2f 63 72 |line 40: /tmp/cr|
00000080 6f 6e 2e 32 30 30 38 30 39 30 36 5f 32 33 35 35 |on.20080906_2355|
00000090 30 32 0d 2e 35 38 38 34 2e 6c 6f 67 3a 20 4e 6f |02..5884.log: No|
000000a0 20 73 75 63 68 20 66 69 6c 65 20 6f 72 20 64 69 | such file or di|
000000b0 72 65 63 74 6f 72 79 0a 2f 75 73 72 2f 73 62 69 |rectory./usr/sbi|
000000c0 6e 2f 73 65 6e 64 6d 61 69 6c 3a 20 6c 69 6e 65 |n/sendmail: line|
000000d0 20 34 30 3a 20 2f 74 6d 70 2f 63 72 6f 6e 2e 32 | 40: /tmp/cron.2|
000000e0 30 30 38 30 39 30 37 5f 32 33 35 35 30 32 0d 2e |0080907_235502..|
000000f0 33 32 30 34 2e 6c 6f 67 3a 20 4e 6f 20 73 75 63 |3204.log: No suc|
00000100 68 20 66 69 6c 65 20 6f 72 20 64 69 72 65 63 74 |h file or direct|
00000110 6f 72 79 0a 2f 75 73 72 2f 73 62 69 6e 2f 73 65 |ory./usr/sbin/se|
00000120 6e 64 6d 61 69 6c 3a 20 6c 69 6e 65 20 34 30 3a |ndmail: line 40:|
00000130 20 2f 74 6d 70 2f 63 72 6f 6e 2e 32 30 30 38 30 | /tmp/cron.20080|
00000140 39 30 38 5f 32 33 35 35 30 32 0d 2e 38 33 36 2e |908_235502..836.|
00000150 6c 6f 67 3a 20 4e 6f 20 73 75 63 68 20 66 69 6c |log: No such fil|
00000160 65 20 6f 72 20 64 69 72 65 63 74 6f 72 79 0a |e or directory.|
0000016f
I am baffled as to why this is a problem, and have seen it on two
different systems both running Windows 2003 Server.
cygcheck output attached...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 22590 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20080909/91ba8958/attachment.obj>
-------------- next part --------------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list