Crontab Job Output File


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Crontab Job Output File
# 1  
Old 01-07-2013
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
Code:
00 10 * * 0 /usr/local/bin/backup.sh > /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
# 2  
Old 01-07-2013
Why can't you give the right permission to the back up file when logged in as Root.
# 3  
Old 01-07-2013
If you do not like to do it manually you can add a chmod line in crontab
Code:
00 15 * * 0 chmod 644 /backup/backup.`date +\%Y\%m\%d`

or just do it after your command

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

Moderator's Comments:
Mod Comment Video tutorial on how to use code tags in The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Crontab job is not working

hell all: i am trying to test a crontab job for snmpwalk but it is not working: here is crontab: */1 * * * * root /root/snmpwalk.sh for the script, it is very simple: #!/usr/local/bin/bash /usr/local/bin/snmpwalk -v 2c -c public 100.10.10.10 (6 Replies)
Discussion started by: ipfreak
6 Replies

2. SuSE

A crontab job not working

Hello, This is my first posting in Linux world. I have SLES 11. I've created a file 'packdisk-scandisk.txt' file under /var/opt/Teradata/bteqdba. The content of the file is, cat /var/opt/Teradata/bteqdba/packdisk-scandisk.txt output over /var/opt/Teradata/bteqdba/TAREAS_DBA.log... (2 Replies)
Discussion started by: JDBA
2 Replies

3. Shell Programming and Scripting

Crontab Job Syntax

I have a ksh script that does the following 1. Script executes and creates an output file from a sql query 2. That output file is an input file to the script 3. generates an html file to email to DBA receipients The following syntax works at the command line ... (1 Reply)
Discussion started by: JolietJake
1 Replies

4. Shell Programming and Scripting

Shell Script to grep Job File name and Log File name from crontab -l

Hello, I am new to shell scripting. I need to write a shell script where i can grep the name of file ie. .sh file and log file from crontab -l. #51 18 * * * /home/oracle/refresh/refresh_ug634.sh > /home/oracle/refresh/refresh_ug634.sh.log 2>&1 #40 17 * * * /home/oracle/refresh/refresh_ux634.sh... (1 Reply)
Discussion started by: guptra
1 Replies

5. Shell Programming and Scripting

Schedule a job using Crontab

I would like to execute my script at 17.30 and 23.00 using crontab, could anybody help me out!! Thanks in Advance!! (1 Reply)
Discussion started by: jatanig
1 Replies

6. Shell Programming and Scripting

output file of the shell script running through crontab is deleting automatical daily.

Dear Friends, I am working on IBM AIX. I have written one script and kept in the crontab as to run daily at 11:38 AM. and the output of the script to be appended to the file generated with the month name. but my file deleting daily and the new file is creating with the output of the shell... (2 Replies)
Discussion started by: innamuri.ravi
2 Replies

7. UNIX for Dummies Questions & Answers

crontab job not running

Hi all, down here part of the scheduled job in crontab (AIX Version 5) i have problem running jspPRE-ALL. i verrify permissions and privileges (the others job are working good) if i run the job in command line it work correctly # # Aggiornamento doni e continuity 00 02 * * 2-6... (5 Replies)
Discussion started by: ilpasta
5 Replies

8. UNIX for Dummies Questions & Answers

Crontab keeps saving empty files of the job file.

Hey, MAILTO=cron@domain.ca */20 * * * * /usr/bin/wget http://list.domain.ca/admin/consume.php >/dev/nullthats what the crontab is setup todo, so basically every 20minutes it runs consume.php In my root directory, i'm getting files like this: consume.php consume.php1 consume.php2 i woke... (3 Replies)
Discussion started by: iarp
3 Replies

9. Shell Programming and Scripting

Help with a crontab job!!!

Hi, i need to schedule a script to run at 6.10AM everyday.I tried to do this way. #!bin/ksh 10 06 * * 0-6 sh /tmp/ss/script/daily_file_check.sh And at the command prompt I did >crontab -e cron.txt I'm not sure whether this is the right way. Can anyone please tell me how to... (4 Replies)
Discussion started by: kumarsaravana_s
4 Replies

10. UNIX for Dummies Questions & Answers

crontab job

Hi, I have cornjob was scheduled at 1:00 AM everyday. It has been running fine since last Saturday. But it didn't run since Saturday. Because of daytime saving time change it didn't ran? Please send me your thoughts. Thanks in adavance. Moe (3 Replies)
Discussion started by: Moe
3 Replies
Login or Register to Ask a Question