Created
June 17, 2020 20:24
-
-
Save gmolveau/45ee52f3ec629480c307173dcb75d879 to your computer and use it in GitHub Desktop.
Bash/shell script command keep-alive sudo until the command has finished
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Ask for the sudo password | |
| sudo -v | |
| # Keep-alive: update existing `sudo` time stamp until the command 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