0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

任意のシェル(shell)スクリプトをsystemdで管理する

Posted at

目的

ubuntu上で作成したpythonプログラムをシェルスクリプトから呼び出して、systemdで管理する必要が出た。

方法

/etc/systemd/system/配下に以下のファイルを設置する

$ vi mon.service
mon.service
[Unit]
Description = テストファイル

[Service]
Type=simple
User=root
Group=root
TimeoutStartSec=0
Restart=on-failure
RestartSec=30s

ExecStart   = /home/shoma/mon/mon.sh

[Install]
WantedBy    = multi-user.target

/home/shoma/mon/mon.shファイルが今回管理したいスクリプトである。

サービス起動

systemctl daemon-reload
systemctl start mon
systemctl enable mon

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?