CentOS 7 systemd service开机启动设定

时间:2022-03-24 16:46:42

#vi /etc/systemd/system/xxx.service

 1 [Unit]
 2 Description=startup script test
 3 
 4 [Service]
 5 Type=simple
 6 ExecStart=/usr/local/bin/xxx/xxx.sh
7 Restart=always 8 # RestartSec=30 9 # TimeoutSec=30 10 11 [Install] 12 WantedBy=multi-user.target

#systemctl enable xxx.service

 

参考:http://www.ruanyifeng.com/blog/2016/03/systemd-tutorial-commands.html