vim /etc/systemd/system/auto_check.service
[Unit] Description=The python script used for release After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=simple ExecStart=/usr/bin/python3 /www/wwwroot/crontab.py Restart=on-failure [Install] WantedBy=multi-user.target
启动该脚本并且开机运行
systemctl start auto_check systemctl enable auto_check
启动该服务 sudo systemctl start auto_check
重启该服务 sudo systemctl restart auto_check
停止该服务 sudo systemctl stop auto_check
查看运行状态 sudo systemctl status auto_check
设置开机运行 sudo systemctl enable auto_check
查看日志 journalctl -xu auto_check

评论