How to make sure an application keeps running on Linux

前端 未结 16 1366
清歌不尽
清歌不尽 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:23

    One can install minutely monitoring cronjob like this:

    crontab -l > crontab;echo -e '* * * * * export DISPLAY=":0.0" && for app in "eiskaltdcpp-qt" "transmission-gtk" "nicotine";do ps aux|grep -v grep|grep "$app";done||"$app" &' >> crontab;crontab crontab

    disadvantage is that the app names you enter have to be found in ps aux|grep "appname" output and at same time being able to be launched using that name: "appname" &

提交回复
热议问题