Hi,

>Hi,

>is there any way to start user service before/after suspend.target? In
>wiki.archlinux.org there are only system sleep hooks [1]. I tried to lock the

yes, but they also describe, how you can add a system service handling
special user things.

[...]

You can create a service named for example "suspend_user@.service":

------------------------< snip snip snip >-----------------------------
[Unit]
Description=User suspend actions for KDE
After=sleep.target remote-fs.target
Requires=remote-fs.target
StopWhenUnneeded=yes

[Service]
User=%I
Type=oneshot
ExecStart=...
TimeoutSec=300

[Install]
WantedBy=sleep.target
------------------------< snip snip snip >-----------------------------

And enable it with:
systemctl enable suspend_user@<user>.service.

It worked for me for a while.

A much better approach is to write a script or program listening for the
according signals "PrepareForSleep" and "PrepareForShutdown" on the dbus
interface "org.freedesktop.login1".
You can start it for example in your .bashrc or in the KDE startup
routines.


>R.H.

Bye.
Michael.
-- 
Michael Hirmke
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to