Results 1 to 4 of 4

Thread: PM-SUSPEND Scripts Not Running Using Sleep-Key

  1. #1
    Join Date
    May 2015
    Beans
    7

    PM-SUSPEND Scripts Not Running Using Sleep-Key

    I'm finding that the scripts under "/etc/pm/sleep.d" don't seem to run unless "pm-suspend" is manually invoked.

    If I press the "Sleep" key on my keyboard, or if I click the "Suspend" menu item under the power cog, the scripts don't seem to run.
    I have a test item meant to fix my audio issue, but when it didn't work, I added a "logger" statement and that didn't even show in the logs. I then added "touch" statements and the files were never touched.
    Code:
    $ sudo gedit /etc/pm/sleep.d/50alsa
    Code:
    #!/bin/bash# Restore audio
    touch /home/nater/Desktop/test1
    logger test1
    logger $1
    case "$1" in
         hibernate|suspend)
    touch /home/nater/Desktop/test2
                 # Stopping is not required
                 ;;
         thaw|resume)
    touch /home/nater/Desktop/test3
    logger test2
                 /usr/bin/pulseaudio -k && sudo /sbin/alsa force-reload
    logger test3
    touch /home/nater/Desktop/test4
                 ;;
         *) exit $NA
                 ;;
    esac
    Code:
    $ sudo chmod +x /etc/pm/sleep.d/50alsa
    Works (files touched, log written to):
    manually invoke: "$ sudo pm-suspend"
    Does Not Work (files NOT touched, log NOT written to):
    Press "Sleep" key on keyboard.
    Click "Suspend" menu item under power cog.

    Bug?

  2. #2
    dino99's Avatar
    dino99 is offline Ubuntu addict and loving it
    Join Date
    Jun 2006
    Location
    Nux Jam
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: PM-SUSPEND Scripts Not Running Using Sleep-Key

    if you are using vivid then systemd is the default. Maybe that script needs a fix to be compatible with it. In that vivid case, switch to upstart when booting to see if the script works then.

  3. #3
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,048
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: PM-SUSPEND Scripts Not Running Using Sleep-Key

    Open a terminal and run xev. Place the mouse cursor in the box and type the sleep key and see if there is a valid keycode associated with it. If so, then perhaps assign pm-suspend command to it. You may have to work on permissions, since keyboard shortcuts are run with user privilege.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  4. #4
    Join Date
    May 2010
    Location
    uk
    Beans
    9,324
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: PM-SUSPEND Scripts Not Running Using Sleep-Key

    Hi

    systemd does not use pm-utils.

    This is why your scripts are not invoked when you sleep using the sleep key but are invoked using a call to one of the pm-utils commands directly.

    You'll need to create to create a service file for the suspend and hibernate targets.

    There is a pretty good write-up on the Arch wiki.

    Kind regards
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •