You are not logged in.

#1 2013-11-22 14:10:39

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

[SOLVED] Why doesn't this systemd sleep script work as expected?

Hey all,

After having a service file to restart an application (that outputs text to the root window for DWM's statusbar) that kept failing numerous times, I decided to go back to the good old scripts to manage things. I already have one in use for my powersaving scripts, that looks like this:

#!/bin/sh

case $1/$2 in
  pre/*)
    /usr/bin/powersave false ;;
  post/*)
    if cat /sys/class/power_supply/BAT1/status | grep Discharging > /d$
    then
        /usr/bin/powersave true
    else
        /usr/bin/powersave false
    fi
    ;;
esac

I based the new script on it, which looks like this:

#!/bin/sh

case $1/$2 in
    pre/*)
        /usr/bin/killall dwmst
    ;;
    post/*)
        /usr/bin/sleep 3 && /usr/bin/dwmst &
    ;;
esac

But it's not working after suspend; my application is not launched. When I run the script from the terminal, it does work as expected. Here's the output of journalctl:

nov 22 15:05:48 edge systemd-sleep[7405]: /usr/lib/systemd/system-sleep/dwmst.sh exited with exit status 1.

What is wrong here?

EDIT 23-12-2013: I went back to a systemd service file.

Last edited by Unia (2013-12-23 00:04:40)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#2 2013-11-22 15:11:21

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Why doesn't this systemd sleep script work as expected?

If you test it by putting some things in there that print to a file or the journal or something, do they show up?  I'm just wondering if the formatting is somehow screwed up (which it doesn't appear to be), or if it might be some kind of a race between the things run by /usr/bin/powersave and the things it writes to.

Offline

#3 2013-11-22 15:14:48

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: [SOLVED] Why doesn't this systemd sleep script work as expected?

Indeed, those messages do not show. What does this mean?

I could, of course, combine both scripts but the Wiki clearly states multiple scripts should work so I'd prefer that.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

Board footer

Powered by FluxBB