Created
July 15, 2012 20:55
-
-
Save cowboy/3118588 to your computer and use it in GitHub Desktop.
Revisions
-
cowboy revised this gist
Jul 16, 2012 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ #!/bin/bash # Might as well ask for password up-front, right? sudo -v # Keep-alive: update existing sudo time stamp if set, otherwise do nothing. while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & # Example: do stuff over the next 30+ mins that requires sudo here or there. function wait() { echo -n "["; for i in {1..60}; do sleep $1; echo -n =; done; echo "]" } -
cowboy revised this gist
Jul 15, 2012 . 1 changed file with 26 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,31 @@ #!/bin/bash # Ask for password. sudo true # Update existing sudo time stamp if set, otherwise do nothing. while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & # Do tons of stuff over the next 30+ mins that requires sudo here or there. function wait() { echo -n "["; for i in {1..60}; do sleep $1; echo -n =; done; echo "]" } wait 0 # show reference bar echo "$(sudo whoami) | $(date)" wait 1 echo "$(sudo whoami) | $(date)" wait 2 echo "$(sudo whoami) | $(date)" wait 5 echo "$(sudo whoami) | $(date)" wait 10 echo "$(sudo whoami) | $(date)" wait 15 echo "$(sudo whoami) | $(date)" wait 1 sudo -K echo "$(whoami) | $(date)" wait 2 echo "$(whoami) | $(date)" wait 5 echo "done." -
cowboy revised this gist
Jul 15, 2012 . 1 changed file with 2 additions and 9 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,14 +4,7 @@ sudo true # keep sudo from timing out while true; do sudo -v; sleep 60; kill -0 "$$" 2>/dev/null || exit; done & # do tons of stuff over the next 60 mins that requires sudo only here or there # ... -
cowboy created this gist
Jul 15, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ #!/bin/bash # ask for password sudo true # keep sudo from timing out pid=$$ { while true; do sudo -v sleep 60 kill -0 "$pid" 2>/dev/null || exit done } & # do tons of stuff over the next 60 mins that might require sudo here or there # ...