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

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