Why cronjob fails to execute script in 'sh' shell in Red Hat Enterprise Linux 6?
Issue
- Our cron job uses 'tee' command to write some messages into the standard output and a log file.
- When it's defined as below, it stopped on the way to output messages into a log file.
20 21 * * * sh /root/test.sh
- But, when it's defined as below, all messages were output into the log file properly.
20 21 * * * sh /root/test.sh > /dev/null 2>&1
- Why it didn't work properly in the former case?
Environment
Red Hat Enterprise Linux 6.3
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
