scripts with output

Over several years, I have built-up a suite of backup scripts. The
scripts report errors and other status to the console using 'echo',
'ls' and 'cat'. I would like to run these as a cron job. Will output
to stdout cause
problems or just be ignored?
droid [ Do, 08 November 2007 19:24 ] [ ID #1865323 ]

Re: scripts with output

On Nov 8, 12:24 pm, droid <jshowal... [at] gmail.com> wrote:
> Over several years, I have built-up a suite of backup scripts. The
> scripts report errors and other status to the console using 'echo',
> 'ls' and 'cat'. I would like to run these as a cron job. Will output
> to stdout cause
> problems or just be ignored?

by default output of stdout and stderr are emailed to the running user
of the cron... you can disable this by adding MAILTO="" to the
beginning of your cron, in which case stdout and stderr will go
nowhere... or you could go through your scripts and redirect stdout
and stderr to /dev/null
CSGill [ Do, 08 November 2007 19:50 ] [ ID #1865326 ]

Re: scripts with output

On Nov 8, 1:50 pm, CSG... [at] gmail.com wrote:
>
> by default output of stdout and stderr are emailed to the running user
> of the cron... you can disable this by adding MAILTO="" to the
> beginning of your cron, in which case stdout and stderr will go
> nowhere... or you could go through your scripts and redirect stdout
> and stderr to /dev/null

Very instructive - thanks!
droid [ Fr, 09 November 2007 05:23 ] [ ID #1866341 ]

Re: scripts with output

On 8 Nov 2007 10:24:44 -0800, droid <jshowalter [at] gmail.com> wrote:

>Over several years, I have built-up a suite of backup scripts. The
>scripts report errors and other status to the console using 'echo',
>'ls' and 'cat'. I would like to run these as a cron job. Will output
>to stdout cause
>problems or just be ignored?

Wouldn't you want these to be placed into a log file instead of going
where nobody will see them? For example

/path/to/your_script >/path/to/your_logfile 2>&1


Scott McMillan
Scott McMillan [ Mo, 12 November 2007 15:54 ] [ ID #1868200 ]

Re: scripts with output

On Nov 12, 9:54 am, Scott McMillan <smcmil... [at] twmi.rr.com> wrote:
>
> Wouldn't you want these to be placed into a log file instead of going
> where nobody will see them? For example
>
> /path/to/your_script >/path/to/your_logfile 2>&1
>

Good idea, Scott! stderr has always been re-directed to an error log;
so I could just redirect my own error reporting there.
droid [ Di, 13 November 2007 12:52 ] [ ID #1869016 ]
Linux » comp.unix.shell » scripts with output

Vorheriges Thema: [gnu.bash.bug] BASH Frequently-Asked Questions (FAQ version 3.36)
Nächstes Thema: sql statement inside a here document