• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Timing a program

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic