How to make sure an application keeps running on Linux

前端 未结 16 1336
清歌不尽
清歌不尽 2020-11-28 18:51

I\'m trying to ensure a script remains running on a development server. It collates stats and provides a web service so it\'s supposed to persist, yet a few times a day, it

16条回答
  •  借酒劲吻你
    2020-11-28 19:18

    A nice, simple way to do this is as follows:

    1. Write your server to die if it can't listen on the port it expects
    2. Set a cronjob to try to launch your server every minute

    If it isn't running it'll start, and if it is running it won't. In any case, your server will always be up.

提交回复
热议问题