Correction des scripts d'exemple

This commit is contained in:
kitoy
2022-08-07 04:03:55 +02:00
parent 9094654956
commit 73002b5fb3
3 changed files with 13 additions and 10 deletions

View File

@@ -38,7 +38,7 @@ check_app_mail()
{
mail=$1
while read line; do
if ["mail" == "line"]; then
if [ "$mail" == "$line" ]; then
echo "Adress already exist"
exit 2;
fi;
@@ -48,16 +48,15 @@ check_app_mail()
add_alias()
{
print "$2":" $1" >> "$alias_file"
print "$2":" $1" >> "$ALIAS_FILE"
}
del_alias()
{
while read line; do
if [ "$1: $2" = "$line" ]; then
cat alias | grep -w -v -e "$1" > /tmp/alias.tmp
mv /tmp/alias.tmp "$alias_file"
isremove=1
cat "$ALIAS_FILE" | grep -w -v -e "$1" > /tmp/alias.tmp
mv /tmp/alias.tmp "$ALIAS_FILE"
fi
done < "$ALIAS_FILE"
}
@@ -98,9 +97,11 @@ case $2 in
check_alias $3
check_app_mail $3
add_alias $1 $3
smtpctl update tables virtuals
;;
"del")
del_alias $3 $1
smtpctl update table virtuals
;;
*)
usage

View File

@@ -33,7 +33,7 @@ check_app_mail()
{
mail=$1
while read line; do
if ["mail" == "line"]; then
if [ "$mail" == "$line" ]; then
echo "Adress already exist"
exit 2;
fi;
@@ -101,12 +101,14 @@ case $1 in
"del")
check_domain "$2"
delete_mail_account "$2"
;;
smtpctl update table passwd
;;
*)
check_domain "$1"
check_alias "$1"
check_app_mail "$1"
add_mailbox "$1"
change_password "$1" "$2"
;;
smtpctl update table passwd
;;
esac