Crontab Job Output File | Unix Linux Forums | Shell Programming and Scripting

  Go Back    

Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Crontab Job Output File

Shell Programming and Scripting

Closed Thread    
Thread Tools Search this Thread Display Modes
Old 01-07-2013
famasutika's Avatar
famasutika famasutika is offline
Registered User
Join Date: Jun 2010
Last Activity: 20 June 2013, 1:44 AM EDT
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Crontab Job Output File

I am a newbie to Unix.

My default root user umask is set to 077 and I have the following crontab job to redirect al the backup output to the logfile of /backup/backup.xxxxx

00 10 * * 0 /usr/local/bin/ > /backup/backup.`date +\%Y\%m\%d` 2>&1

Since root default umask is 077, the backup logfile of /backup/backup.xxxx is only readable to root itself. But I want to allow non-root or normal account to be able to read the backup logfile. Is there a way to achieve this in the crontab syntax itself?

Last edited by Franklin52; 01-08-2013 at 03:45 AM.. Reason: Please use code tags for data and code samples
Sponsored Links
Old 01-07-2013
sathyaonnuix's Avatar
sathyaonnuix sathyaonnuix is offline
Registered User
Join Date: Aug 2012
Last Activity: 26 June 2014, 12:23 PM EDT
Posts: 129
Thanks: 35
Thanked 14 Times in 13 Posts
Why can't you give the right permission to the back up file when logged in as Root.
Sponsored Links
Old 01-07-2013
manni2 manni2 is offline
Registered User
Join Date: May 2009
Last Activity: 25 November 2013, 8:11 AM EST
Posts: 27
Thanks: 1
Thanked 1 Time in 1 Post
If you do not like to do it manually you can add a chmod line in crontab

00 15 * * 0 chmod 644 /backup/backup.`date +\%Y\%m\%d`

or just do it after your command

00 10 * * 0 /usr/local/bin/ > /backup/backup.`date +\%Y\%m\%d` 2>&1 ; chmod 644 /backup/backup.`date +\%Y\%m\%d`

Moderator's Comments:
Video tutorial on how to use code tags in The UNIX and Linux Forums.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell Script to grep Job File name and Log File name from crontab -l guptra Shell Programming and Scripting 1 09-08-2012 01:10 AM
output file of the shell script running through crontab is deleting automatical daily. innamuri.ravi Shell Programming and Scripting 2 10-14-2009 02:08 AM
Crontab keeps saving empty files of the job file. iarp UNIX for Dummies Questions & Answers 3 10-20-2008 07:47 PM
Help with a crontab job!!! kumarsaravana_s Shell Programming and Scripting 4 03-28-2007 05:02 AM
crontab job Moe UNIX for Dummies Questions & Answers 3 11-02-2005 05:17 PM

All times are GMT -4. The time now is 02:50 AM.