Add systemd support

Bug #1447321 reported by Laércio de Sousa
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Epoptes
Fix Released
Low
Fotis Tsamis

Bug Description

Now that Debian/Ubuntu are switching to systemd as default, it's time to Epoptes provide a better systemd support, which envolves:

 * Ship systemd service unit files for both epoptes[-server] and epoptes-client.

 * Add "systemctl reboot" and "systemctl poweroff" fallbacks to /usr/share/epoptes-client/endsession.

 * Gather more information from logind, specially about seats.

About service unit files, I've written the following examples for openSUSE package:

epoptes.service:

[Unit]
Description=A twisted-based daemon that manages epoptes-client
After=syslog.target

[Service]
Type=forking
PIDFile=/run/epoptes.pid
ExecStartPre=/bin/sh -c "if ! [ -s /etc/epoptes/server.key ] || ! [ -s /etc/epoptes/server.crt ]; then openssl req -batch -x509 -nodes -newkey rsa:1024 -days 3652 -keyout /etc/epoptes/server.key -out /etc/epoptes/server.crt; chmod 600 /etc/epoptes/server.key; fi"
ExecStart=/usr/bin/twistd --pidfile /var/run/epoptes.pid --logfile /var/log/epoptes.log epoptes

[Install]
WantedBy=multi-user.target

epoptes-client.service:

[Unit]
Description=Epoptes-client system daemon
Wants=network-online.target
After=network-online.target

[Service]
EnvironmentFile=-/etc/default/epoptes-client
ExecStartPre=/bin/sh -c "if ! [ -s /etc/epoptes/server.crt ]; then /usr/sbin/epoptes-client -c ${SERVER}; fi"
ExecStart=/usr/sbin/epoptes-client

[Install]
WantedBy=multi-user.target

NOTE: network-online.target may require that you explicitly enable the *-wait-online.service that matches your current network management mechanism (NetworkManager, systemd-networkd, etc.)

In the case one requires that epoptes-client service automatically restarts if connection is lost, he can provide the following drop-in:

/etc/systemd/system/epoptes-client.service.d/auto-reconnect.conf:

[Service]
Restart=always

Related branches

Revision history for this message
Laércio de Sousa (lbssousa) wrote :

I'm also trying to provide a systemd user service for epoptes-client (to be launched with /etc/xdg/autostart/epoptes-client.desktop), so it could be automatically restarted also for user sessions. However, I still can't make some functions to work properly, like logout, reboot, and poweroff (mainly because I can't talk to system dbus daemon from within a systemd user instance, or something similar).

Fotis Tsamis (ftsamis)
Changed in epoptes:
assignee: nobody → Fotis Tsamis (ftsamis)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Fotis Tsamis (ftsamis) wrote :

Added support for shutdown/reboot/logout on systemd (trunk revno 441). The unit files will be added in the future when systemd is better established.

Changed in epoptes:
status: Confirmed → Fix Committed
Revision history for this message
Fotis Tsamis (ftsamis) wrote :

Fix released in 0.5.8.
Thanks for your report!

Changed in epoptes:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.