Created
October 26, 2017 16:47
-
-
Save sdr01810/d507b94cad9980beaf609bfdea060993 to your computer and use it in GitHub Desktop.
Shell function check_user_is_root_or_devops() and friends.
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
function check_user_is_root_or_devops() { | |
if ! user_is_root_or_devops ; then | |
post_delayed_exit 2 "You must be root or devops to execute this command; aborting." | |
fi | |
} | |
function user_is_root_or_devops() { | |
[ "$(id -u)" -eq 0 -o "$(id -un)" = "devops" ] | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment