Help us understand the problem. What is going on with this article?

systemd で symboliclink の service を enable する

現在、 /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 ファイルを置く

参考

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした