You are not logged in.

#1 2016-10-04 19:20:16

AlexIL
Member
From: Israel
Registered: 2016-01-02
Posts: 45
Website

[SOLVED] systemd suspend hook not run

I have wrote a suspend hook like written in: https://wiki.archlinux.org/index.php/Po … vice_files
Which I put in /etc/systemd/system/resume@.service, this is its content:

[Unit]
Description=User resume actions
After=suspend.target

[Service]
Type=Simple
User=%I
ExecStartPost=/usr/bin/i3lock

[Install]
WantedBy=suspend.target

I have enabled it by typing: sudo systemctl enable resume@alex
Where alex is my username.
After suspending i3lock is not executed (the screen is not locked).
What can I do?

Last edited by AlexIL (2016-10-04 19:48:42)

Offline

#2 2016-10-04 19:39:55

onslow77
Member
Registered: 2014-09-21
Posts: 283

Re: [SOLVED] systemd suspend hook not run

AlexIL wrote:

What can I do?

Hello!

I suggest you do the following:
- Check the status for the unit/service you wrote
- Read your journal and look for any errors connected to the unit/service you wrote
- Solve the problem/ask for help if you are unable to solve it yourself

Regards
Martin

Last edited by onslow77 (2016-10-04 19:41:02)

Offline

#3 2016-10-04 19:41:22

loqs
Member
Registered: 2014-03-06
Posts: 18,859

Re: [SOLVED] systemd suspend hook not run

User#How_it_works

systemd --user runs as a separate process from the systemd --system process. User units can not reference or depend on system units.

Edit:
Misread it as you were running it as a user service sorry for the noise

Last edited by loqs (2016-10-04 19:44:14)

Offline

#4 2016-10-04 19:48:27

AlexIL
Member
From: Israel
Registered: 2016-01-02
Posts: 45
Website

Re: [SOLVED] systemd suspend hook not run

My unit file wasn't written properly which resulted in errors.
Here's the working one:

[Unit]
Description=User resume actions
Before=sleep.target

[Service]
Type=forking
User=alex
Environment=DISPLAY=:0
ExecStart=/usr/bin/i3lock --image /home/alex/Pictures/lockscreen.png --show-failed-attempts -c 000000
ExecStartPost=/usr/bin/sleep 1

[Install]
WantedBy=sleep.target

Thanks for the help, I'll mark it as solved.

Offline

Board footer

Powered by FluxBB