Cron Tab help


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Cron Tab help
# 1  
Old 11-14-2008
Cron Tab help

Hi All
I have a requirement to schedule my script through cron tab.
I have 2 scripts to schedule.

Case1:My script should run every day in the server.It should be triggered in every 2 mins interval.i.e suppose i implemented the script now my script should run every 2 mins.How can i redirect the log of my cron job to a output file.When i gave the 1st condition as 02 i think it is referring to 12:02 to start it.

Case2:Another script should also run every day and in every 2 hours interval.

The script should run life long with the specified interval.How can i write such a cron tab job.
# 2  
Old 11-14-2008
Code:
#Runs every 2 mins and outputs stdout to /path/to/log
*/2 * * * * /path/to/script >> /path/to/log
#runs every 2 hours on the hour 1:00, 2:00, 3:00........ and does not log anywhere
0 */2 * * * /path/to/script 1>/dev/null 2>&1

# 3  
Old 11-14-2008
thanks a lot for your immediate response
# 4  
Old 11-14-2008
*/2 * * * * /export/home/sas/spawner.ksh >> /export/home/sas/xyz.log 2>&1



crontab: error on previous line; unexpected character found in line.

crontab: errors detected in input, no crontab file generated.

can you please look into the error
# 5  
Old 11-14-2008
Hp-ux??

You have to supply all the times, no shortcuts.

Code:
0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /export/home/sas/spawner.ksh >> /export/home/sas/xyz.log 2>&1

# 6  
Old 11-14-2008
is this thing machine specific...
wat about the job which runs every 2 hours...
Do i need to specify
* 0,2,4,8,10,12,14,16,18,20,22 * * * /export/home/sas/script.ksh
# 7  
Old 11-14-2008
On most linux distros you can use */2 * * * * for every 2 mins and * */2 * * * for every 2 hours. But HP-UX is a bit more picky, doesnt have all the 'nice' this added, just functional items.

Yes for the hourly you have to do the same thing.

Is it HP-UX, you didnt specify? In the future be specific as to the OS when asking questions.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Cron Tab Setup in Ubuntu

Hi, I need to install the crontab utility in Ubuntu. Can any one one tell me what exactly is the steps to do it? Thanks in Advanced (2 Replies)
Discussion started by: diehard
2 Replies

2. Shell Programming and Scripting

problem with the cron tab.

Hi, I have a cron tab file , which executes a particular script in a scheduled time and creates a output file. Since the cron tab file was created by the root , there is no access permission( for the output files) for other users irrespective of the default directory permission on which the... (5 Replies)
Discussion started by: BalajiUthira
5 Replies

3. Shell Programming and Scripting

Cron tab

Hi, We have a couple of jobs are scheduled in CRONTAB. Now. I want generate a report for each job how many times ran successful and failed in a 1 month of time period. is there any way to find in CRONTAB. Please advise on this. (1 Reply)
Discussion started by: koti_rama
1 Replies

4. Shell Programming and Scripting

Cron tab query

Hi In my Unix server more than 500 cron jobs are scheduled daily and weekly basics. Now,I would like to know only list of JOBs,which are running only on 14th of every month? How can i find only which are all jobs will be scheduled only on 14th. Please tell me the script. (4 Replies)
Discussion started by: koti_rama
4 Replies

5. Shell Programming and Scripting

Cron Tab entries

Hi All, I am required to make a crontab entry, I have the below requirement: 1. It should execute at 06:15 12:00 and 18:30 2. It should execute every day of the month for all the 30 days I am going to add the below entry in the crontab file. 15,0,30 6,12,18 * * 0-6 cd... (3 Replies)
Discussion started by: Shazin
3 Replies

6. Solaris

cron tab setting

hi guys , i need some help i want to set cron job for every sunday , of each month so any body plz help or this proble :confused: (1 Reply)
Discussion started by: Kbharat20
1 Replies

7. Shell Programming and Scripting

Problem with Cron tab

I have a script for pinging the switches and giving me the report:- #!/usr/local/bin/perl #!/bin/ksh #!/usr/bin #etc `source /export/home/chinnigd/.profile`; @names = `cat switches|cut -f1 -d' '`; @ip = `cat switches|cut -f2 -d' '`; $num = @names; $re ="Empty"; $i = 0; $flag = 0; while... (3 Replies)
Discussion started by: chinnigd
3 Replies

8. Shell Programming and Scripting

Cron tab help need

need help to write crontab my crontabe file every minute to rsh and check that it is running or not i want to change it on every 1o minute please help me example of my crontab #check if system is running * * * * * rsh metal3 /users/test/run.server i want to check that every 10... (2 Replies)
Discussion started by: deepa20
2 Replies

9. UNIX for Dummies Questions & Answers

Cron Tab problem

I have a script that is being called from cron job . This script further call 3 scripts which runs in the background . main script ( called from cron ) { script1 & script2 & script3 & } How to know when the main script is over ?? (3 Replies)
Discussion started by: rahul123_libra
3 Replies

10. UNIX for Advanced & Expert Users

cron tab commands

Hello: If I want to run a crontab every hour between 9 am to 9pm, will this work 00 09-19 * * * /.../.../../program.sh If the above does not work, what should it be ?? Thanks, ST2000 (4 Replies)
Discussion started by: ST2000
4 Replies
Login or Register to Ask a Question