Running scrpt at wake

  • I don't have a file called /storage/.config/sleep.conf.d/99-sample.power.x

    I have a README & sleep.conf.sample

    I created a file in that directory called 99script.sh. Permission is 755. The script redirects the output of date to a file. But nothing happens after the system wakes up.

    What am I missing?

    Edited once, last by labzilla (March 28, 2023 at 5:58 PM).

  • Sorry, the sample seem to have been deleted.

    Create the directory mkdir /storage/.config/sleep.d and the script:

    Bash: /storage/.config/sleep.d/myscript.power
    #!/bin/sh
    case "$1" in
       pre)
         # <do something on suspend>
         ;;
       post)
         # <do something on resume>
         ;;
    esac
  • I'm assuming it's supposed to be the /storage/.config directory, the dot is missing. I'm also assuming that anything in that directory that has execute permission will be executed.

    /storage/test.txt is never created after a sleep/wake or reboot. Shouldn't myscript.power run whenever there is a power change?

  • I'm assuming it's supposed to be the /storage/.config directory, the dot is missing.

    Yes.

    I'm also assuming that anything in that directory that has execute permission will be executed.

    Any *.power file is executed.

    Is working on my LE11 Generic-legacy machine and logged to the journal:

    Code
    Boot[1303]: ### running sleep script 20-custom-sleep.sh (pre)... ###
    Boot[1307]: ### running custom sleep script /storage/.config/sleep.d/myscript.power (pre)... ###