[systemd-devel] How to depend a user session service on a system service?

Kai Krakow hurikhan77 at gmail.com
Wed Mar 9 19:26:01 UTC 2016


Hello!

I have some user session services running (executing Rails background
workers, e.g. sidekiq etc.). On one busy/bigger server, when booting
the machine, these user sessions fail to start up due to timeouts.

Actually, it feels wrong to just bump up the timeouts. I'd rather make
them depend on the mysqld service (which is the slowest to start) and
redis (it makes no sense without it) but that actually fails on me:
Trying to start the user service now says that the service is unknown:


$ systemctl --user cat sidekiq at invitation_tool.service
# /etc/systemd/user/sidekiq at .service
[Unit]
Description=sidekiq for %i
After=redis.service
Requires=redis.service

[Service]
Type=simple
Environment=RAILS_ENV=production
WorkingDirectory=%h/rails-apps/%i/current
ExecStart=/usr/bin/env bin/sidekiq -C config/sidekiq.yml
ExecStop=/bin/kill -TERM $MAINPID
TimeoutStartSec=300s
Restart=on-failure

[Install]
WantedBy=default.target


So it looks like user session deps are completely isolated from the
system dependencies namespace. How do I circumvent this? I'd like to
depend user session services on system services.

Optimally this could be solved by proper socket activation but
apparently most service are still far from supporting it.

-- 
Regards,
Kai

Replies to list-only preferred.



More information about the systemd-devel mailing list