시스템 사용자 단위를 만들고 시스템 부팅시 시작하려고합니다. 서비스는 수동으로 시작되지만 부팅시 시작되지 않습니다.
인터넷 검색을 통해 부팅시 사용자 장치를 시작하려면을 실행해야한다고 생각 loginctl enable-linger <username>
했지만 전혀 효과가 없었습니다. 실제로 매뉴얼 페이지는 다음과 같이 말합니다.
Enable/disable user lingering for one or more users. If enabled for a specific user, a user manager is spawned for the user at boot and kept around after logouts. This allows users who are not logged in to run long-running services.
이 명령을 실행하더라도 부팅시 서비스가 시작되지 않습니다.
loginctl enable-linger error
단위:
$ cat ~/.config/systemd/user/thin\@.service
[Unit]
Description=A fast and very simple Ruby web server
[Service]
Type=simple
EnvironmentFile=/home/error/.config/thin/%i
ExecStart=/usr/bin/bash /home/error/.rvm/wrappers/%i/thin start -a $THIN_BIND -p $THIN_PORT
WorkingDirectory=/srv/www/%i
PrivateTmp=true
[Install]
WantedBy=multi-user.target
재부팅하면 실행되지 않습니다.
$ systemctl --user status thin@redmine -l
● thin@redmine.service - A fast and very simple Ruby web server
Loaded: loaded (/home/error/.config/systemd/user/thin@.service; enabled; vendor preset: enabled)
Active: inactive (dead)
# systemctl status user@1000 -l
● user@1000.service - User Manager for UID 1000
Loaded: loaded (/usr/lib/systemd/system/user@.service; static; vendor preset: disabled)
Active: active (running) since Wed 2015-12-23 19:43:27 GMT; 13s ago
Main PID: 613 (systemd)
Status: "Startup finished in 38ms."
CGroup: /user.slice/user-1000.slice/user@1000.service
├─613 /usr/lib/systemd/systemd --user
└─615 (sd-pam)
Dec 23 19:43:27 redmine systemd[613]: Reached target Sockets.
Dec 23 19:43:27 redmine systemd[613]: Starting Sockets.
Dec 23 19:43:27 redmine systemd[613]: Reached target Timers.
Dec 23 19:43:27 redmine systemd[613]: Starting Timers.
Dec 23 19:43:27 redmine systemd[613]: Reached target Basic System.
Dec 23 19:43:27 redmine systemd[613]: Starting Basic System.
Dec 23 19:43:27 redmine systemd[613]: Reached target Default.
Dec 23 19:43:27 redmine systemd[613]: Startup finished in 38ms.
Dec 23 19:43:27 redmine systemd[613]: Starting Default.
Dec 23 19:43:27 redmine systemd[1]: Started User Manager for UID 1000.
수동으로 시작할 수 있으며 작동합니다.
$ systemctl --user start thin@redmine
$ systemctl --user status thin@redmine -l
● thin@redmine.service - A fast and very simple Ruby web server
Loaded: loaded (/home/error/.config/systemd/user/thin@.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2015-12-23 19:43:50 GMT; 5s ago
Main PID: 1265 (ruby)
CGroup: /user.slice/user-1000.slice/user@1000.service/thin.slice/thin@redmine.service
└─1265 ruby /home/error/.rvm/gems/ruby-2.2.1@redmine/bin/thin start -a ::1 -p 8008
Dec 23 19:43:50 redmine systemd[613]: Started A fast and very simple Ruby web server.
Dec 23 19:43:50 redmine systemd[613]: Starting A fast and very simple Ruby web server...
Dec 23 19:43:52 redmine bash[1265]: /home/error/.rvm/gems/ruby-2.2.1@redmine/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: duplicated key at line 466 ignored: "inodot"
# systemctl status user@1000 -l
● user@1000.service - User Manager for UID 1000
Loaded: loaded (/usr/lib/systemd/system/user@.service; static; vendor preset: disabled)
Active: active (running) since Wed 2015-12-23 19:43:27 GMT; 40s ago
Main PID: 613 (systemd)
Status: "Startup finished in 38ms."
CGroup: /user.slice/user-1000.slice/user@1000.service
├─613 /usr/lib/systemd/systemd --user
├─615 (sd-pam)
└─thin.slice
└─thin@redmine.service
└─1265 ruby /home/error/.rvm/gems/ruby-2.2.1@redmine/bin/thin start -a ::1 -p 8008
Dec 23 19:43:27 redmine systemd[613]: Startup finished in 38ms.
Dec 23 19:43:27 redmine systemd[613]: Starting Default.
Dec 23 19:43:27 redmine systemd[1]: Started User Manager for UID 1000.
Dec 23 19:43:50 redmine systemd[613]: Created slice -.slice.
Dec 23 19:43:50 redmine systemd[613]: Starting -.slice.
Dec 23 19:43:50 redmine systemd[613]: Created slice thin.slice.
Dec 23 19:43:50 redmine systemd[613]: Starting thin.slice.
Dec 23 19:43:50 redmine systemd[613]: Started A fast and very simple Ruby web server.
Dec 23 19:43:50 redmine systemd[613]: Starting A fast and very simple Ruby web server...
Dec 23 19:43:52 redmine bash[1265]: /home/error/.rvm/gems/ruby-2.2.1@redmine/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: duplicated key at line 466 ignored: "inodot"
부팅시이 서비스가 시작되지 않는 이유를 어떻게 알 수 있습니까?
운영 체제는 Fedora 23 x86_64, 시스템 222-10입니다.