Fwd: Re: writing to /dev/stdout fails in cron script
sorry - wrong button :(
-------- Original Message --------
Subject: Re: writing to /dev/stdout fails in cron script
Date: Fri, 22 Aug 2014 16:58:20 +0200
From: Tony van der Hoff <tony@vanderhoff.org>
To: Sven Hartge <sven@svenhartge.de>
On 22/08/14 15:57, Sven Hartge wrote:
> Tony van der Hoff <tony@vanderhoff.org> wrote:
>
>> Cron task is invoked from a simple crontab entry:
>> # /home/tony/crontab -- crontab for user tony
>> MAILTO=tony@vanderhoff.org
>> SHELL=/bin/sh
>> <snip>
>> * * * * * /home/tony/scripts/test
>
>> tony@tony-fr:~$ ls -al /dev/stdout
>> lrwxrwxrwx 1 root root 15 Aug 21 17:30 /dev/stdout -> /proc/self/fd/1
>
>> tony@tony-fr:~$ ls -ald /dev
>> drwxr-xr-x 15 root root 3340 Aug 21 17:30 /dev
>
> At least you don't have a multi-gigabyte /dev/stdout-file on your system
> filled with the output of numerous scripts from years ago :)
>
> I'd guess /proc/self/fd/1 is different for programs invoked from cron,
> because cron redirects stdout to catch any output from programs.
>
Well, indeed. The output from cron scripts normally goes to mail in this
case. I'm rather hoping that is where the output from stdout would go.
> Please add something like this:
>
> ls -al /proc/self/fd/1 /dev/stdout 2>&1 > /tmp/testoutput
>
> to your script and provide the output. Maybe this will be helpful.
>
lrwxrwxrwx 1 root root 15 Aug 21 17:30 /dev/stdout -> /proc/self/fd/1
l-wx------ 1 tony tony 64 Aug 22 16:39 /proc/self/fd/1 -> /tmp/testoutput
Not sure how that helps :(
Thanks, Sven.
--
Tony van der Hoff | mailto:tony@vanderhoff.org
Ariège, France |
Reply to: