add exit error codes
This commit is contained in:
parent
a3f1eda0d7
commit
bc7eafbbb2
@ -29,20 +29,20 @@ vmail:getoptions "$@"
|
|||||||
# check for email
|
# check for email
|
||||||
if [[ -z $email ]]; then
|
if [[ -z $email ]]; then
|
||||||
echo "email is required"
|
echo "email is required"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check for password
|
# check for password
|
||||||
if [[ -z $password ]]; then
|
if [[ -z $password ]]; then
|
||||||
echo "password is required"
|
echo "password is required"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get domain_id (and thus check if domain already exists)
|
# get domain_id (and thus check if domain already exists)
|
||||||
domain_id=`mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -s -r -N -e "SELECT id from vm_domains WHERE domain='$domain';"`
|
domain_id=`mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -s -r -N -e "SELECT id from vm_domains WHERE domain='$domain';"`
|
||||||
if [ -z $domain_id ] ; then
|
if [ -z $domain_id ] ; then
|
||||||
echo "ERROR: Domain $domain does not exist."
|
echo "ERROR: Domain $domain does not exist."
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# make sure mbox doesn't already exist
|
# make sure mbox doesn't already exist
|
||||||
@ -85,7 +85,7 @@ if [ "$rowcount" -eq '0' ] ; then
|
|||||||
dbcmd="$dbcmd;'"
|
dbcmd="$dbcmd;'"
|
||||||
elif [ "$rowcount" -eq '1' ] ; then
|
elif [ "$rowcount" -eq '1' ] ; then
|
||||||
echo "ERROR: $email already exists in vmail database."
|
echo "ERROR: $email already exists in vmail database."
|
||||||
exit
|
exit 1
|
||||||
else
|
else
|
||||||
echo "ERROR: System error querying vmail database."
|
echo "ERROR: System error querying vmail database."
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user