Linux进程守护

crontab

service

edit /etc/systemd/system/x.service

[Unit]
Description=ServerStatus.chyi.org
After=network.service

[Service]
Type=simple
ExecStart=/usr/bin/python2.7 /root/Git/serverstatus/client-linux.py
Restart=on-failure

[Install]
WantedBy=multi-user.target

start and enable

systemctl start x
systemctl enable x

reload to update

systemctl daemon-reload
systemctl start x
systemctl status x
systemctl restart x
systemctl stop x

supervisor

install

apt-get install supervisor
pip3 install supervisor
yum install supervisor

Leave a Reply

Your email address will not be published. Required fields are marked *