Skip to content

Instantly share code, notes, and snippets.

@SaBenBurra
Created July 13, 2024 23:09
Show Gist options
  • Save SaBenBurra/f1ff7340cb3606521a2b2949eba9f50b to your computer and use it in GitHub Desktop.
Save SaBenBurra/f1ff7340cb3606521a2b2949eba9f50b to your computer and use it in GitHub Desktop.
no_wakeup_usb.service
grep -f <(lspci | grep USB | cut -d " " -f 1) \
<(cat /proc/acpi/wakeup) | cut -c 1-4 | tr -d '\t' \
| sed -e 's|^|echo |' -e 's|$| > /proc/acpi/wakeup|' -e '1s|^|#!/bin/bash\n|' \
| sudo tee /usr/local/bin/nowakeupusb >/dev/null \
&& sudo chmod +x /usr/local/bin/nowakeupusb && printf '%s\n' '[Unit]' \
'Description=no-wakeup-usb' '[Service]' \
'ExecStart=/usr/local/bin/nowakeupusb' \
'[Install]' 'WantedBy=multi-user.target' \
| sudo tee /etc/systemd/system/no_wakeup_usb.service >/dev/null \
&& sudo systemctl enable no_wakeup_usb.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment