请教如何自动重启进程

12 views
Skip to first unread message

Michael Ding

unread,
May 14, 2012, 9:30:51 AM5/14/12
to 讨论组Shanghai LUG

如果有个后台任务,可能自动停止。请问有没有办法监控其状态,一旦停止,就自动重启?打扰各位了

YiZhi Liu

unread,
May 14, 2012, 9:45:19 AM5/14/12
to sh...@googlegroups.com
http://cr.yp.to/daemontools/supervise.html
这个应该可以满足你的需求

在 2012年5月14日 下午9:30,Michael Ding <yandy...@gmail.com> 写道:
> 如果有个后台任务,可能自动停止。请问有没有办法监控其状态,一旦停止,就自动重启?打扰各位了

--
Yizhi Liu
@ZheJiang University

Liu Cheng

unread,
May 14, 2012, 9:45:57 AM5/14/12
to sh...@googlegroups.com
supervise?

2012/5/14 Michael Ding <yandy...@gmail.com>:

Michael Ding

unread,
May 14, 2012, 10:00:54 AM5/14/12
to sh...@googlegroups.com

哈哈,谢谢!

Yiling Cao

unread,
May 15, 2012, 2:30:53 AM5/15/12
to sh...@googlegroups.com
$> while true; do run_the_fucking_job; sleep 10; done

2012/5/14 Michael Ding <yandy...@gmail.com>

Druggo

unread,
May 15, 2012, 12:01:18 PM5/15/12
to sh...@googlegroups.com
monit

Stone Zhang

unread,
May 16, 2012, 5:55:34 AM5/16/12
to sh...@googlegroups.com
There are many ways to monitor a app.

But , firstly, a process could not restart by itself while it crash.

So, you need a process X to monitor a app A.

Monitor method is like socket or dbus and so on.

在 12-5-15,Druggo<dru...@gmail.com> 写道:


> monit
>
> On Monday, May 14, 2012 9:30:51 PM UTC+8, Michael Ding wrote:
>>
>> 如果有个后台任务,可能自动停止。请问有没有办法监控其状态,一旦停止,就自动重启?打扰各位了
>>
>


--
我是stone

源泉星火(张明源)

unread,
May 16, 2012, 6:19:48 AM5/16/12
to sh...@googlegroups.com
while true;do cmd;done
watcn cmd
就可以了,monit和supervise太高级了,其实应该用不到

2012/5/16 Stone Zhang <kelx...@gmail.com>



--
明源
http://www.Linuxzh.org
Twitter: @muxueqz
Reply all
Reply to author
Forward
0 new messages