The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

Views: 3,476     Votes:  6 
Tag : startup-applications  
Link: 🔍 See Original Answer on Ask Ubuntu 🔗

Title: How to run script after resuming from sleep?
ID: /2018/11/16/How-to-run-script-after-resuming-from-sleep_
Created: November 16, 2018    Edited:  June 12, 2020
Upload: November 24, 2022    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false

Run Script when Resuming from Suspend

Create a new file /lib/systemd/system-sleep/resume and copy in:


case $1/$2 in
    echo "Going to $2..."
    # Place your pre suspend commands here, or `exit 0`
    # if no pre suspend action required
    exit 0
    echo "Waking up from $2..."
    # Place your post suspend (resume) commands here, or `exit 0` 
    # if no post suspend action required

NOTE: replace user (third line from the bottom) with your script name. Provide the full path name if the script is not in your path (echo $PATH).

Then mark it executable with the command:

sudo chmod +x /lib/systemd/system-sleep/resume
⇧ Temporarily switch to a full-screen, hairline cursor I'm looking for a command to flash screens (if possible in colors)  ⇩