I would like to have a service watchdog script echo the status to the screen if called like ./watchdog.sh but if it is run by cron, there is no need to echo output. What is the proper method? Where does stdout go when a script is run under root's crontab?
Take the 2-minute tour
×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.
For the many cron jobs that I run, I purposely make them so if run on command line appropriate outout is generated but the same script if placed in crontab I always capture both the stdout and stderr to a log file:
|
|||
|
Cronjob output is sent to the user via the system's mail system. You can check whether stdout is a terminal:
|
||||
|