Notes - GNU/Linux (desktop)

Return to note list
Run a command on resume using systemd

This is based upon an example from the Arch Linux wiki.

Create the following systemd service file at /etc/systemd/system/resume@.service:

[Unit]
Description=Resume actions for user %I
After=suspend.target

[Service]
User=%i
Type=simple
ExecStart=/usr/bin/env sudo -u %i /home/%i/bin/resumeAutostart

[Install]
WantedBy=suspend.target

Then enable it for your user systemctl enable resume@**username**.service. You must enable it for each user you want to be able to run something on resume. Then the script ~/bin/resumeAutostart will be run on resume.