On 22/08/14 11:35, Sven Hartge wrote: > Tony van der Hoff <[email protected]> wrote: > >> Running up-to-date Wheezy. > >> I have a script, simplified like this: > >> ----------------------------- >> #!/bin/bash >> DEBUG=1 > >> OUT=/dev/null > >> if [ $DEBUG -ne 0 ]; then >> OUT=/dev/stdout >> fi > >> echo hello > $OUT >> ----------------------------- > >> This works fine when invoked from the command line, but when called as a >> cron task, same user, it fails with >> /home/tony/scripts/test: line 10: /dev/stdout: Permission denied > > What is /dev/stdout on your system? It should look like this: > > ~$ ls -al /dev/stdout > lrwxrwxrwx 1 root root 15 Aug 6 23:06 /dev/stdout -> /proc/self/fd/1 > > Maybe the symlink was replaced by a file with insufficient permissions, > thus the error. > > If that is the case, please remove the file and recreate the symlink. > (Or reboot, since /dev should be on a tmpfs the symlink will be created > at boot time.) > > _If_ the symlink is correctly in place as show above, please provide the > output of "ls -ald /dev", maybe the permissions to /dev are wrong.
Cron task is invoked from a simple crontab entry: # /home/tony/crontab -- crontab for user tony [email protected] 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 Thanks for your help -- Tony van der Hoff | mailto:[email protected] Ariège, France | -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: https://lists.debian.org/[email protected]

