補覺鳴詩

學海無涯


  • 首頁

  • archive

  • 關於我

  • 搜尋

linux centos systemd create service

時間: 2022-02-21   |   分類: linux   centos   rocky linux   systemd   | 字數: 72 字 | 閱讀: 1分鐘 | 閱讀次數:

有些程式沒有包裝成 service 執行以此篇為記錄

先寫一個腳本或是程式 該腳本能正常執行並不停止

建立 service file /etc/systemd/system/coredns.service

[Unit]
Description=coredns

[Service]
Type=simple
ExecStart=/root/coredns/coredns -conf corefile
Restart=always

[Install]
WantedBy=multi-user.target

設定權限、reload server

chmod 644 /etc/systemd/system/coredns.service
systemctl daemon-reload
#linux# #centos# #rocky linux# #systemd#
comments powered by Disqus >
  • 文章目錄
  • 網站導覽
Owan

Owan

愛貓如癡

131 日誌
29 分類
37 標籤
GitHub
© 2010 - 2022 補覺鳴詩
Powered by - Hugo v0.96.0 / Theme by - NexT
0%