Tony van der Hoff <t...@vanderhoff.org> wrote: > On 22/08/14 15:57, Sven Hartge wrote: >> Tony van der Hoff <t...@vanderhoff.org> wrote: >> >>> Cron task is invoked from a simple crontab entry: >>> # /home/tony/crontab -- crontab for user tony >>> MAILTO=t...@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.
If you want to have an output which is selectable between debug and no-debug output it would be better to write a small shell function and use that instead of "echo" to print things. Much more flexible, you can even easily add a timestamp on front of every messagen etc. >> 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 :( No, but this was my fault. "/proc/self/fd/1" is magic, it always points to the stdout of current program. If you redirect it, like I asked you to do, then of course /proc/self/fd/1 points to the new target. So please only use "ls -al /proc/self/fd/1 /dev/stdout" and paste the output from the mail you get. Grüße, Sven. -- Sigmentation fault. Core dumped. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/7auae9alg...@mids.svenhartge.de