Skip to content

Instantly share code, notes, and snippets.

@KevinLiebergen
Last active August 2, 2021 16:54
Show Gist options
  • Save KevinLiebergen/b6562341bfbf1f262a797428eccd8d86 to your computer and use it in GitHub Desktop.
Save KevinLiebergen/b6562341bfbf1f262a797428eccd8d86 to your computer and use it in GitHub Desktop.
Script to restart network daemon when it fucking fails
#!/bin/bash
ping -c 1 -W 1 1.1.1.1 || sudo systemctl restart NetworkManager.service
@KevinLiebergen
Copy link
Author

$ sudo visudo

And insert line (to not ask for password every time):

kevinvanliebergen ALL=NOPASSWD: /bin/systemctl restart NetworkManager.service

Change kevinvanliebergen to your username

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment