Advanced Scheduled Process/Task Manager - Linux

删除回忆录丶 提交于 2019-12-08 07:12:36

问题


Need some advice, I'm after a decent process/task manager for Ubuntu.

Basically I have a few scripts/programs which I want to run as long running processes, but I want to shut them down at various periods (say over the weekend or every day for a few hours). During the time that the process needs to be up and crashes, I would like it so that the task scheduler will automatically restart the process.

SO for example, I want to run program X between 9:00-17:00 every day. If the process is still running it should be killed at 17:00. If the process crashes between 9AM and 5PM then the process should be automatically restarted.

Are there any easy to use tools which can do this? I would like to avoid having to manage PID files and having cron jobs which do the start and stop...

Any thing anyone recommends? Any advice appreciated!

Cheers.


回答1:


I do not know if a tool exists for this, but except if you have many interactive tasks, it really does not a that big issue to manage for a few jobs :

1) You can start your cronjobs whenever you like thanks to the crontab,

2) You can insert a "commit suicide" within these scripts under a time condition for example.

# your script doing things
# Then it commit suicide
if [ your_condition ];then
  kill $$
fi

Please note that if you want to allow users login only at certain periods of time, then it's a different question.



来源:https://stackoverflow.com/questions/6443252/advanced-scheduled-process-task-manager-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!