LoginSignup
0
0

More than 5 years have passed since last update.

Ubuntu 16.04 systemd で起動時にスクリプトを実行しようとしたらハマった件

Posted at

1. スクリプトをroot権限で実行できるようにする

諸々を/usr/local/bin/において、root権限でも実行できるようにする。
service定義ではUser指定ができるようであるが、/var/logに吐き出したかったので、、、

2. [Install]を書く

/etc/systemd/system/hoge.serviceの一番下に

[Install]
WantedBy=multi-user.target

が必要だった模様。

これらを確認した後、
shell
sudo systemctl reenable hoge.service

とすれば、次回boot時にスクリプトが自動実行される。

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