systemd使用示例

[Unit]
Description=monitor sg_ai_framework_box
After=network.target

[Service]
User=root
Type=forking
ExecStart=/data/script/run/start.sh
ExecStop=/data/script/run/stop.sh
PrivateTmp=true
Restart=always

[Install]
WantedBy=multi-user.target

 

1.启动nfs服务

systemctl start nfs-server.service

 

2.设置开机自启动

systemctl enable nfs-server.service

 

3.停止开机自启动

systemctl disable nfs-server.service

 

4.查看服务当前状态

systemctl status nfs-server.service

 

5.重新启动某服务

systemctl restart nfs-server.service

 

6.查看所有已启动的服务

systemctl list -units --type=service

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章