Skip to content

Instantly share code, notes, and snippets.

@hayleyxyz
Created July 8, 2019 20:58
Show Gist options
  • Save hayleyxyz/04769c6a5822da66561e16f13213a083 to your computer and use it in GitHub Desktop.
Save hayleyxyz/04769c6a5822da66561e16f13213a083 to your computer and use it in GitHub Desktop.
systemd service to automatically toggle swapon when a certain usb drive is installed
[Unit]
Description=Flash drive swapon
Requires=dev-disk-by\x2duuid-7849984a\x2de42f\x2d497a\x2dafec\x2d8bebb8384f7a.device
After=dev-disk-by\x2duuid-7849984a\x2de42f\x2d497a\x2dafec\x2d8bebb8384f7a.device
[Service]
ExecStart=/sbin/swapon -U 7849984a-e42f-497a-afec-8bebb8384f7a
[Install]
WantedBy=dev-disk-by\x2duuid-7849984a\x2de42f\x2d497a\x2dafec\x2d8bebb8384f7a.device
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment