Created
June 13, 2016 11:12
-
-
Save tsprlng/0b4b0865f4c9e7de372f3f29fb2b1a0a to your computer and use it in GitHub Desktop.
¿Sufficiently? paranoid deploy script
This file contains 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
#!/bin/bash | |
if [ $(/usr/bin/whoami) == 'deployer' ]; then | |
# auto-escalate -- run this same script as root | |
exec /usr/bin/sudo $0 $1 | |
fi | |
if [ $1 == 'restartable-thing' ]; then | |
# run restart script with empty environment | |
/usr/bin/env -i /usr/sbin/service restartable-thing restart | |
else | |
echo 'What are you talking about?' | |
exit 4 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment