[PLUG] Suppressing shell script output to screen

Robert Citek robert.citek at gmail.com
Tue Sep 19 22:17:15 UTC 2017


Cron will e-mail them to the root account by default.  Usually, I
redirect output from cron job entries to a log file so that I can
review/parse them.  For example:

03 * * * * /home/foo/bin/some_script.sh >> /home/foo/log/some_script.log 2>&1

The "2>&1" means redirect file descriptor 2 (STDERR) to file
descriptor 1 (STDOUT).  Since file descriptor 1 is going to
/home/foo/log/some_script.log, so will the error messages.

Good luck and let us know if that works for you.

Regards,
- Robert

On Tue, Sep 19, 2017 at 3:02 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
>    I have written a short bash script to have root run sa-learn on my
> spam-uncaught file once each week. When sa-learn runs it posts a message to
> the console on the number of messages read and the number of messages added
> to the database.
>
>    Where does this message appear if the script is run from cron.weekly? The
> sa-learn man page does not offer an option for 'quiet' output so I don't
> know if that result message can be suppressed.
>
> Rich
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug



More information about the PLUG mailing list