Skip to content

Instantly share code, notes, and snippets.

@kiwimato
Created October 6, 2021 18:00
Show Gist options
  • Save kiwimato/f985ce1504c1acdc48b018774fa51b85 to your computer and use it in GitHub Desktop.
Save kiwimato/f985ce1504c1acdc48b018774fa51b85 to your computer and use it in GitHub Desktop.
Creates a service which automatically restarts chronyd after suspend or hibernation upon resume
cat > /usr/lib/systemd/system/chronyd-restart-after-sleep.service <<'EOF'
[Unit]
Description=Restart Bluetooth after resume
After=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
[Service]
Type=simple
ExecStart=/usr/bin/systemctl --no-block restart chronyd
#ExecStart=/usr/bin/systemctl --no-block restart bluetooth.service
[Install]
WantedBy=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
EOF
systemctl enable chronyd-restart-after-sleep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment