You are not logged in.

#1 2018-06-28 19:45:46

gnumdk
Member
Registered: 2009-10-15
Posts: 175

Systemd user unit on GNOME logout

Hello,

I'm trying to run a script on GNOME logout with systemd but it does not works :-/

[Unit]
Description=Sync data

[Service]
Type=oneshot
ExecStart=/usr/local/bin/login.sh

[Install]
WantedBy=exit.target

Enabled with: systemctl --user --global enable logout

But not launched at logout, any idea?

Offline

#2 2018-06-28 20:40:21

hussam
Member
Registered: 2006-03-26
Posts: 572
Website

Re: Systemd user unit on GNOME logout

I have something similar that works.
/home/hussam/.config/systemd/user/syncdata.service

[Unit]
Description=Sync data

[Service]
Type=oneshot
ExecStart=/usr/bin/echo "hello"
ExecStop=/usr/bin/syncdata.sh

[Install]
WantedBy=default.target

enabled by systemctl --user enable syncdata.service then start the service also with --user.

Last edited by hussam (2018-06-28 20:41:34)

Offline

#3 2018-06-29 21:06:39

gnumdk
Member
Registered: 2009-10-15
Posts: 175

Re: Systemd user unit on GNOME logout

Does not really work, just replace syncdata.sh with /bin/sleep 60 and you will see the logout does not lock for 60 seconds

Offline

#4 2018-07-07 16:14:09

hussam
Member
Registered: 2006-03-26
Posts: 572
Website

Re: Systemd user unit on GNOME logout

Try RemainAfterExit=yes and set TimeoutStopSec to a large amount of time.
Does syncdata.sh exit with a 0 return value on success?

Offline

Board footer

Powered by FluxBB