Re: crontab problem with stdout



On 2007-11-21 02:59, root wrote:
I am getting screwed up trying to get around the problems with
stdout using cron. What I want to do is periodically fetch
a formatted web page, process that, and send the result
to a file. I use w3m to format the page:

w3m -dump http://somepage

First I tried processing that via a pipe:

w3m -dump http://somepage | process >>final.result

But the stdout for the input to the pipe gets lost.
...

Maybe you redirect stdout in your crontab entry.

Just try:
(w3m -dump http://somepage | process >>final.result) 2>> final.errors

But be nice when using cron for jobs that do remote things, and think what the
owner of http://somepage like if thousands of cronjobs should do the same at
the same time from unix/linux where the clock mostly is synced, and will generate a network storm.

Rules. Never do cron entries at minute 0 for remote access, and calculate with
the possible risk that a site don't respond, so if you run it more often then the timeout, you will mess up your output.

/bb
.



Relevant Pages

  • crontab problem with stdout
    ... stdout using cron. ... a formatted web page, process that, and send the result ... But the stdout for the input to the pipe gets lost. ... exec first && exec second ...
    (alt.os.linux)
  • Re: Silent Cron Jobs
    ... afaik cron mails all output from a script. ... cronjob I usually dump all stdout ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • cron continues to email when no stdout/stderr from script
    ... I continue to receive email when I run a script that produces no stdout ... The man page for cron states ... "cron captures the output of the job's stdout and stderr streams, ... and, if it is non-empty, mails the output to the user. ...
    (comp.unix.solaris)
  • Re: scripts with output
    ... scripts report errors and other status to the console using 'echo', ... I would like to run these as a cron job. ... by default output of stdout and stderr are emailed to the running user ...
    (comp.unix.shell)
  • Re: cron send mail only when an error occurs
    ... > he needs to keep the stdout in a log/output file, ... > unless there is stderr output. ... Here is what is in a lot of our cron scripts. ...
    (comp.unix.shell)