LoginSignup
2
1

More than 3 years have passed since last update.

systemd で symboliclink の service を enable する

Last updated at Posted at 2019-06-28

現在、 /etc/systemd/system へ手動で symlink を張ってしまうと too many levels of symbolic links のエラーが出るのでその解決方法です。

ここに回答があります。
https://github.com/systemd/systemd/issues/3010#issuecomment-282502364

# systemctl enable /path/to/git/foo/foo.service

手動で symblink を貼らずに上のコマンドを叩くと下のように symlink を作ってくれます。

/etc/systemd/system/multi-user.target.wants/foo.service -> /path/to/git/foo/foo.service                                                                                                                                                                                                       
/etc/systemd/system/foo.service -> /path/to/git/foo/foo.service.     

ただし、2019-07時点では、こうして設置した service はサーバの reboot 時に
Cannot add dependency job for unit foo.service, ignoring: Unit not found
のエラーが出て自動で立ち上がらないことが分かりました。
(systemctl daemon-reload したあとで start すれば立ち上がる)

解決策は色々探しましたが、以下の2つのいずれかにするしかないようです。

  • symlinc は諦め unit ファイルを直接 /etc/systemd/system に copy しておく
  • 再起動時に systemctl daemon-reload と systemctl start foo を実行する unit ファイルを置く

参考

2
1
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
2
1