Cron and standard output redirection

Cron and standard output redirection

Post by Mauricio R Rodrigu » Sat, 09 Mar 1996 04:00:00



        I've recentely written a bash shell script with that is
supposed to backup my user's directories every night (using cron).  The
job was submitted into the crontab from within an su(root) session.  

        I've set the permissions on the script to set user and group ID
on execution (s).  The script is owned by root.root.  

        My problem:  I want to output the filenames of the files that tar

directory.  When I run the script from an interactive shell as root,
all works well.  When it is run by cron, the file is created, but the
filenames go somewhere unknown.

        I hope someone can help me with this one.

Thanks,
Mauricio Rodriguez

 
 
 

Cron and standard output redirection

Post by Niall P . O'Mea » Thu, 14 Mar 1996 04:00:00



>        I've recentely written a bash shell script with that is
>supposed to backup my user's directories every night (using cron).  The
>job was submitted into the crontab from within an su(root) session.  
>    I've set the permissions on the script to set user and group ID
>on execution (s).  The script is owned by root.root.  
>    My problem:  I want to output the filenames of the files that tar

>directory.  When I run the script from an interactive shell as root,
>all works well.  When it is run by cron, the file is created, but the
>filenames go somewhere unknown.
>    I hope someone can help me with this one.

By default, any output by cron is mailed to root unless explicitly
told otherwise. I have cron entries that look like the following:

0 1 * * * /var/adm/tools/script 2>&1 > /dev/null
        this rediercts all cron output to "/dev/null"

0 1 * * * /var/adm/tools/script 2>&1 | {email address}
        this pipes all cron output to  {email address}

try it. I think this is what you want.

>Thanks,
>Mauricio Rodriguez


Niall P. O'Meara
CN Rail Telecom Engineering
Montreal, Qc.


 
 
 

1. standard output redirection to multiple files

i know how to use the exec command to redirect standard output and
input to a file e.g.:

./file.ksh > out > 2&1

or in the script

exec 2>&1 > out

i have also used the mkpipe command to redirect standard output to the
screen and a file.

can anyone point me towards a method for redirecting standard output
to two files and not the screen ?

2. test post

3. Standard error and output redirection

4. samba and etc/printcap?

5. standard output redirection question

6. Setting netmask only in sysidcfg file

7. Standard error and output redirection

8. Customized installation with customized comps file...

9. Cron output redirection problem

10. cron output redirection

11. Repost of "Output redirection while reformatting the output"

12. redirecting standard output and standard error

13. differentiate between standard output and standard error?