0

I need to run

sudo killall wpa_supplicant

automatically after resume. Unfortunately on 15.04 with systemd it isn't possible with scripts.

How this may be automated?

1 Answer 1

1

You need to place your scripts in:

/lib/systemd/system-sleep/

An example script based on one from the Arch wiki (systemd sleep Hooks):

#!/bin/sh
case $1/$2 in
  pre/*)
    echo "Going to $2..."
    # better to put `exit 0` if no pre suspend action required
    ;;
  post/*)
    echo "Waking up from $2..."
    # Add whatever you want run post suspend (ie resume)
    killall wpa_supplicant
    ;;
esac

Dont forget to make your script executable!

sudo chmod a+x /lib/systemd/system-sleep/your-script

See man systemd-sleep for more details.

There is no need for sudo as your script will be run as root.

4
  • I did all as recommended: created script, saved it to system-sleep dir and chmod to executable. Did not helped. Wifi did not enabled. By the way invoking sudo killall wpa_supplicant manually from command line still helps. May 7, 2015 at 13:47
  • I can only offer guesses. Grep syslog of the message "Waking up from" which should be from systemd-sleep. If you see this message start playing around to see what is going on. for example put ps aux > /tmp/testps or something after echo "waking... to see if wpa_supplicant is running. Maybe you need to sleep for a few seconds first, start high adding sleep 10s before killall wpasupplicant.
    – SpmP
    May 9, 2015 at 3:39
  • Adding sleep 10s is a good idea. I am trying it now. Thanks! May 12, 2015 at 11:38
  • 1
    Works! Now it works as expected. I've set 6s sleep time and for my case it solves. May 12, 2015 at 20:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .