You are not logged in.

#1 2019-08-12 12:48:15

bluesguy
Member
Registered: 2019-08-12
Posts: 1

Shell script under system-sleep directory not executing correctly

I have made a script under /usr/lib/systemd/system-sleep/ to kill compton before suspend and restart it automatically upon wake.

However, only the kill part is executed and compton is not restarted after waking up.

This is my code:

#! /bin/sh

case $1/$2 in
        pre/*)
                pkill compton
                echo "Killed compton. Going to $2..."
                ;;
        post/*)
                compton &
                echo "Restarting compton. Waking up from $2..."
                ;;
esac

When I run journalctl -b -u systemd-suspend.service, I get the following.

Aug 12 20:36:20 arch systemd[1]: Starting Suspend...
Aug 12 20:36:20 arch systemd-sleep[1704]: Killed compton. Going to ...
Aug 12 20:36:20 arch systemd-sleep[1704]: Suspending system...
Aug 12 20:36:35 arch systemd-sleep[1704]: System resumed.
Aug 12 20:36:35 arch systemd-sleep[1704]: Restarting compton. Waking up from ...
Aug 12 20:36:35 arch systemd[1]: systemd-suspend.service: Succeeded.
Aug 12 20:36:35 arch systemd[1]: Started Suspend.

Any help is greatly appreciated!

Offline

#2 2019-08-12 13:10:19

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,423

Re: Shell script under system-sleep directory not executing correctly

Welcome to the boards,

As is compton would be - if anything - run as root, which is not something you want. You'd have to set DISPLAY, XAUTHORITY and execute it as your own user.

That said this somewhat reads like an xy problem, you generally shouldn't need to restart compton, what happens if you don't do that? Which graphics card and driver are you using?

Also while not that problematic for small text blocks like these, you generally want to use [ code ] tags for pasting outputs and snippets.

Last edited by V1del (2019-08-12 13:12:30)

Offline

Board footer

Powered by FluxBB