Add checks for super user exists
This commit is contained in:
@@ -71,6 +71,10 @@ if [ -z "${sudo_user}" ]; then
|
||||
echo "sudo_user not set in the config file ${config_file}";
|
||||
exit;
|
||||
fi;
|
||||
if ! id "${sudo_user}" &>/dev/null; then
|
||||
echo "Sudo user ${sudo_user} does not exist, skipping stanza";
|
||||
exit
|
||||
fi;
|
||||
if [ -z "${pgbackrest_config}" ] ||[ ! -f "${pgbackrest_config}" ]; then
|
||||
echo "Missing pgbackrest default config file ${pgbackrest_config}";
|
||||
exit;
|
||||
@@ -218,6 +222,10 @@ while read -r stanza; do
|
||||
fi;
|
||||
# set override sudo user
|
||||
if [ -n "${stanza_super_user}" ]; then
|
||||
if ! id "${stanza_super_user}" &>/dev/null; then
|
||||
echo "[!] Sudo user ${stanza_super_user} for stanza ${stanza_name} does not exist, skipping stanza";
|
||||
continue;
|
||||
fi;
|
||||
sudo_user="${stanza_super_user}";
|
||||
fi;
|
||||
# build the call command
|
||||
|
||||
Reference in New Issue
Block a user