Check return code

This commit is contained in:
Bob Mottram 2015-10-26 17:25:59 +00:00
parent 93f6cbb1e8
commit 20d65a0b7a
2 changed files with 10 additions and 1 deletions

View File

@ -97,6 +97,11 @@ chmod 600 /home/$MY_USERNAME/README
echo "Adding an XMPP account for $MY_USERNAME"
freedombone-addxmpp -e "$MY_USERNAME@$HOSTNAME" -p "$NEW_USER_PASSWORD"
if [ ! "$?" = "0" ]; then
echo "XMPP account not created"
userdel -r $MY_USERNAME
exit 6
fi
clear
echo "New user $MY_USERNAME was created"

View File

@ -64,11 +64,12 @@ done
if [ ! -d /etc/prosody ]; then
echo 'xmpp server is not installed'
exit 1
exit 0
fi
if [ ! $EMAIL_ADDRESS ]; then
show_help
exit 1
fi
if [ ! $NEW_USER_PASSWORD ]; then
@ -77,6 +78,9 @@ else
USERNAME=$(echo $EMAIL_ADDRESS | awk -F '@' '{print $1}')
DOMAIN_NAME=$(echo $EMAIL_ADDRESS | awk -F '@' '{print $2}')
prosodyctl register $USERNAME $DOMAIN_NAME "$NEW_USER_PASSWORD"
if [ ! "$?" = "0" ]; then
exit 2
fi
fi
exit 0