This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes Cron ta not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Cron ta not working" Watch "Cron ta not working" New topic
Author

Cron ta not working

Namrta Pandey
Ranch Hand

Joined: Jul 22, 2008
Posts: 36
Hi,

I have scheduled some batches in solaris server cron tab, which is my db server. The probem is, that sometimes the batch runs but sometimes the same batch does not picked by cron to run.

Can anybody tell me what can be the reason for this?

Thanks in Advance.
Namrta
Harlin Seritt
Greenhorn

Joined: Apr 22, 2008
Posts: 4
If you can post a copy of the cronjob entry and some code, I'll be happy to help you out.
Namrta Pandey
Ranch Hand

Joined: Jul 22, 2008
Posts: 36
command which I have fired to schedule the batch is :

5,10,15,20,25,30,35,40,45,50,55 * * * * /ActDeact/Cron/Shell_script/PreActDeact.sh
Namrta Pandey
Ranch Hand

Joined: Jul 22, 2008
Posts: 36
Hi All,

I have scheduled my batch in cron via java code which is as follows:



But my cron is not picking up the process to execute. Scheduling of batch is done in the same way as mentioned in trial messages.

Also let me know if there is any way to capture the process in shell script also.

Thanks in Advance
Namrta.
James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

What am I missing? Where is 'cron' involved in the Java code? Are you saying you are running the Java as the cron job via a script and that this then uses Runtime.exec() to invoke another script? What does the cron email show when the process does execute and those times when the cron job does not execute?

Note1 - your cron job will not execute on the hour since 0 is not in the set of times.
Note2 - your use of Runtime.exec() is flawed. You need to read the 4 sections of http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html and implement ALL the recommendations. Failure to do so will just cause you more grief.


Retired horse trader.
 Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Cron ta not working
 
Similar Threads
Bigger type length than maximum
Pulling values from SQL Server
Scheduling Pls Help
Send Mail at perticular time(By capturing database trigger)
Batch Framework in J2EE