Re : Set multiple cron jobs in one crontab file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Re : Set multiple cron jobs in one crontab file
# 1  
Old 12-04-2008
Re : Set multiple cron jobs in one crontab file

Hello All,

Hopw all is fine. I am newbie to Unix. I am using Bourne Shell (sh). One of the question I have is that I am trying to read XML file and based on reading that XML file I want to run different java programs at different hours. Meaning

05 14 * * * java ./program1
10 14 * * * java ./program2
15 14 * * * java ./program3
20 14 * * * java ./program4

When I try to out above code in crontab -e ....then it does not run as expected but if just put one line ( for e.g. 05 14 * * * java ./program1) then it does run.

I am sure I am missing something basic. Will appreciate your feedback on this.

Thanking you ,
Sam
# 2  
Old 12-04-2008
Few points:
1.Put the abs path of the script
2.Source the .profile in the cron job entry before execution of script(REquired only if the script using the environment variables)
# 3  
Old 12-04-2008
Hello Jacob,

Thanks for your reply. I am probably missing it ... but how do I schedule multiple jobs ( at different timings ) in one crontab file ? When I try to do above it just performs the last task ( last line... in here -- 20 14 * * * java ./program4). How can I execute all of the jobs in one crontab file?

Thanks again,
Sam
# 4  
Old 12-04-2008
basicly it should work as you did it in you example. if not there must be another error.
try:
05 14 * * * /bin/date >> /tmp/crontest
06 14 * * * /bin/date >> /tmp/crontest
07 14 * * * /bin/date >> /tmp/crontest
08 14 * * * /bin/date >> /tmp/crontest
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to read file and run multiple jobs

I have a txt file line1 line2 line3 $!/bin/sh cat /tmp/lus.txt | while read line do esxcli storage vmfs unmap -u $lin -n 4000 done this works but does in one line at a time. how do I do all lines at once simutaeously? Please use CODE tags as required by forum rules! (4 Replies)
Discussion started by: tdubb123
4 Replies

2. UNIX for Beginners Questions & Answers

How to run multiple cron jobs?

I have two scripts which I'm tying to run one after the other- this is what I've tried: 00 14 * * * /path/one.sh && /path/two.sh I've also tried putting each script on a different line: 00 14 * * * /path/one.sh 00 14 * * * /path/two.sh Can this be done? (1 Reply)
Discussion started by: $shell_Learner
1 Replies

3. Shell Programming and Scripting

Shell script to run multiple jobs and it's dependent jobs

I have multiple jobs and each job dependent on other job. Each Job generates a log and If job completed successfully log file end's with JOB ENDED SUCCESSFULLY message and if it failed then it will end with JOB ENDED with FAILURE. I need an help how to start. Attaching the JOB dependency... (3 Replies)
Discussion started by: santoshkumarkal
3 Replies

4. UNIX for Dummies Questions & Answers

Crontab jobs excuting

Hi i want to run the cronjob from 7 Am till 11.30Am for every 5 minutes from monday to friday. can anyone help? (15 Replies)
Discussion started by: satheesh_charle
15 Replies

5. Shell Programming and Scripting

Crontab jobs log

hi gurus, I have scheduled some script by using crontab. I would like to save all the logs in some particular directory whenever the jobs are running. please let me know how i need to code it to save the logs files. (2 Replies)
Discussion started by: arun888
2 Replies

6. Shell Programming and Scripting

How to View multiple Cron jobs

Hi, I ran two crontab commands using: crontab program1 crontab program2 However when I type crontab -l only the second cron job shows up, how do I see all cron jobs running and how do I edit all at the same time Thanks in Advance S:D (10 Replies)
Discussion started by: walforum
10 Replies

7. 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

8. Shell Programming and Scripting

Multiple jobs reading from same file

I have a sequence of tasks that I routinely run and I'm trying to parallelize certain portions of the sequence. Specifically, there are 3 tasks which all read from the same file, each performing different operations and writing to their own seperate file. I was wondering if I could execute these... (3 Replies)
Discussion started by: erichpowell
3 Replies

9. UNIX for Dummies Questions & Answers

Editing a cron file with crontab

I want to set up a file with crontab to run the cron deamon so I can use at to schedule jobs. I think the crontab file (or whatever you call it) has to be set up. Currently, I don't have a crontab file (I checked by typing sudo crontab -u myusername -l), and I don't know the syntax for creating... (6 Replies)
Discussion started by: Ultrix
6 Replies

10. AIX

comment jobs in cron for multiple accounts

Hi, We have several jobs scheduled in cron in AIX. Before every release we need to comment those jobs and uncomment those after the release is over. There are several accounts whose cron entries need to be commented. Can anyone provide me with a script which can put a '#' before each line in... (3 Replies)
Discussion started by: shibajighosh
3 Replies
Login or Register to Ask a Question