• Post Reply Bookmark Topic Watch Topic
  • New Topic

Timing a program  RSS feed

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Is there a way I can have a java program to run from 10 am and stop the execution at 5 pm in the evening ,again start/stop it back the same time next day?
Crontab might not be an option since it starts at the specified time, but it runs till the program finishes. There is no way with the crontab that we can stop the execution at a specified time.
If this cannot be done with a UNIX script, then can you please suggest a way I can do it with in the java application.
Thanks for your help.
Divya.
 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Starting a program at 10 AM is eas, by crontab. My question is closing it at 5PM, when you say close it at 5PM, do you mean by program automatic exit? or by using kill command to literally kill it at 5PM (this is not recommended)?
You can have the application itself to terminate at 5PM by using a Scheduler, or a Timer class. Or you can have some kind of client that can send a command or signal to your application and have it kill itself (in this case, a crontab entry at 5PM should be fine).
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!