Cron jobs redirecting output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cron jobs redirecting output
# 1  
Old 08-24-2008
Cron jobs redirecting output

Hi guys with regards to Cron jobs if for example i run a script and it produces output to the admin mail how could i stop it from doing that at script level and redirrect it to a file so that admin does not have all these emails about jobs done correctly.
# 2  
Old 08-24-2008
Redirect stdout and stderr to your file, something like:

Code:
10 * * * * your_script > log_file 2>&1

See crontab(5) for details and sh(1) for how to redirect the file descriptors.

Regards
# 3  
Old 08-24-2008
is there a way of doing it in the actual bash script that im running once a month?

like a verbose command or something similar?
# 4  
Old 08-24-2008
To redirect the stdout and stderr to a file in your script, place this line above the first command in your script:

exec 1> log_file 2>&1

Regards
# 5  
Old 08-24-2008
ohhh oko ill give it a try
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Redirecting output to file through cron

Hi Does anyone have any suggestions for capturing the output into a file when i run it through cron? I have file called "quick.1" which contains two simple commands to be executed on the target host. And i have second file called "quick.2" which contains the wrapper script to ssh to the target... (1 Reply)
Discussion started by: chandika_diran
1 Replies

2. Shell Programming and Scripting

Cron Jobs

How to see which cron jobs are not running? (2 Replies)
Discussion started by: rahul.raj1989
2 Replies

3. Solaris

Diffrent output in cron jobs

Hi, I have issue with cron. When i run script manually output is fine but when i add it to cron output file is not as same. both file attach some junk charecter comming in cron output. thanx Jignesh (5 Replies)
Discussion started by: jkmistry
5 Replies

4. Solaris

Cron jobs and at jobs

There are two jobs in Solaris , Cron and at jobs.. I know how to disable or enable cron jobs. How can I enable at jobs and disable it. Kindly help. Rj (2 Replies)
Discussion started by: jegaraman
2 Replies

5. Shell Programming and Scripting

cron jobs

Hi, please help on this am trying to exec the below mentioned cron jobs but its getting failed fro the past two days ###but when am trying to execte the cron by the times 23,29 18 * * * /export/home/inrvgo/thelak/China.sh its getting exec properly please help on this #... (8 Replies)
Discussion started by: thelakbe
8 Replies

6. UNIX for Dummies Questions & Answers

cron jobs

Hi, We have a group of hosts using which the cron jobs are submitted... Few days ago i had submitted a cron job in of these hosts, but unfortunately forgot the host name :( Can anyone please help me out in finding this host name from which the cron s submitting the job, i dont want the... (2 Replies)
Discussion started by: bhavanisree
2 Replies

7. Solaris

cron jobs

how to Put a cron entry which should be same script triggered on every Saturday and 1st of every month at 01.00 GMT. 0 2 1 * 6 --( At 2.00 GMT every sat & on 1st of every month) the above syntax is correct? Thanks (1 Reply)
Discussion started by: kurva
1 Replies

8. UNIX for Advanced & Expert Users

cron jobs...

I need to start a job every friday night at 8:00 P.M , it runs all the day on Sat and Sun....can somebody tell me how to do this...I understand crontab...but haven't used it.........can u write some steps.....how to create a file and call.....I honestly dont know? Plz help.Thanks (2 Replies)
Discussion started by: RubinPat
2 Replies

9. Solaris

Cron Jobs

I'm trying to run cron jobs to start any inhibited processes after a system reboot. I can schedule th cron, but i'm confused as to how to incorporated the reboot, since reboot is scheduled at different times, once every month. How can I write this to start every 15 min after after a reboot ... (2 Replies)
Discussion started by: Remi
2 Replies

10. UNIX for Advanced & Expert Users

cron jobs

I need to monitor my cron jobs with another unix machine since occasionally the cron will go down on the main server but there are no errors. Can anyone help with a script to write to use the cron on the back up machine to monitor the main server? I am using SCO and the cron jobs have been... (3 Replies)
Discussion started by: rmarral
3 Replies
Login or Register to Ask a Question