Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to monitor c++ daemon process?

Tags:

c++

linux

daemon

I develop one daemon tcp server with boost asio, I want to know is there any daemon manager lib to monitor the process, if the server process is dead, the manager can restart it

like image 243
why Avatar asked Nov 04 '22 17:11

why


1 Answers

You could try to use the very powerfull daemontools to manage everything. These tools allow very in grained monitoring, restarting etc.

If you don't need this power the following shell-script is often enough:

while true; do
   $PROCESS
   sleep $SLEEP_TIME
done

This takes care of restarting your system when it crashes, but there is not much to it and if you need additions you will be out of luck.

like image 118
LiKao Avatar answered Nov 09 '22 09:11

LiKao