Crontab does not create log file
Hi
Our customer is using Red Hat Enterprise 4.4 kernel 2.6.9-42 We are using the root user and we are at the KVM console (not remotely) With crontab -e i see: 10 11 * * * /bin/echo "text ...." >1 /tmp/cron_log 2 >&1 the cron_log is not created even if we simply put /bin/echo "text..." > /tmp/cron_log. Nothing is created. But if we execute the command direclty from the command line, /bin/echo "text...." > /tmp/cron_log, this log file is correclty created. anacron deamon is running crond deamon is running Why is the log file not created, when using the crontab file? is this a bug? please help |
Currently you're logging to a file called "1", proper syntax to append line to text file should be '10 11 * * * /bin/echo "text ...." >>/tmp/cron_log 2>&1'.
|
Crontab does not create log file
unSpawn
Ok, you are right. i put a syntax error in the text in the question below , but still, the log file , even with correct syntax, is not created. As i already mentioned, with crontab -e we change the line to 15 11 * * * /bin/echo "example text" > /tmp/cron_log, save file. then we wait.. a few minutes and we run the ls command in /tmp folder but log does not show up log file is not created. But if we execute the command direclty from the command line, /bin/echo "text...." > /tmp/cron_log, this log file is correclty created. No errors in Systemlog viewer (GUI) , simply nothing happens. no log created with crontab something goes wrong with crontab config or what ? please help |
For sanity purposes, try putting the commands you want to run in a shell script (don't forget to make it executable). Then try to run your shell script in cron, be sure to still include the full path to the script, as you had previously.
For example: crontab: * * * * * /usr/bin/myscript.sh myscript.sh: #!/bin/bash echo Date: `date` >> /tmp/mylog.txt |
Also two other things: 0) do you by any chance have the user listed in /etc/cron.deny or 1) is there cron daemon e-mail with errors in $USER's mailbox?
|
All times are GMT -5. The time now is 09:23 PM. |