Skip to content

Instantly share code, notes, and snippets.

@samuel22gj
Created March 4, 2016 09:12
Show Gist options
  • Save samuel22gj/3d39dc24d4dafeeaafab to your computer and use it in GitHub Desktop.
Save samuel22gj/3d39dc24d4dafeeaafab to your computer and use it in GitHub Desktop.
Make sudo permission keep alive
#!/usr/bin/env bash
# Ask for the administrator password upfront.
sudo -v
# Keep-alive: update existing `sudo` time stamp until the script has finished.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment