changed echo to eval

This commit is contained in:
Matthew Saunders Brown 2021-02-19 17:03:56 -08:00
parent 519aa57df2
commit e54fcfdab1
3 changed files with 24 additions and 25 deletions

View File

@ -61,14 +61,14 @@ if [ "$rowcount" -eq '1' ] ; then
# domain exists, delete from all vmail tables # domain exists, delete from all vmail tables
# singled delete should be sufficient for vm_* tables due to ON DELETE CASCADE foreign key references # singled delete should be sufficient for vm_* tables due to ON DELETE CASCADE foreign key references
dbquery="DELETE FROM vm_domains WHERE domain='$domain';" dbquery="DELETE FROM vm_domains WHERE domain='$domain';"
echo $dbcmd $dbcmdopts "\"$dbquery\"" eval $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM sa_userpref WHERE username LIKE '%@$domain'" dbquery="DELETE FROM sa_userpref WHERE username LIKE '%@$domain';"
echo $dbcmd $dbcmdopts "\"$dbquery\"" eval $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_greylisting WHERE recipient LIKE '%@$domain'" dbquery="DELETE FROM vm_greylisting WHERE recipient LIKE '%@$domain';"
echo $dbcmd $dbcmdopts "\"$dbquery\"" eval $dbcmd $dbcmdopts "\"$dbquery\""
# this should be sufficient for rc due to ON DELETE CASCADE foreign key references # this should be sufficient for rc due to ON DELETE CASCADE foreign key references
dbquery="DELETE FROM rc_users WHERE username LIKE '%@$domain'" dbquery="DELETE FROM rc_users WHERE username LIKE '%@$domain';"
echo $dbcmd $dbcmdopts "\"$dbquery\"" eval $dbcmd $dbcmdopts "\"$dbquery\""
elif [ "$rowcount" -eq '0' ] ; then elif [ "$rowcount" -eq '0' ] ; then
echo "ERROR: $domain does not exist in vmail database." echo "ERROR: $domain does not exist in vmail database."
exit 1 exit 1
@ -78,5 +78,5 @@ else
fi fi
if [ -d "$VMAIL_DIR/$domain" ] ; then if [ -d "$VMAIL_DIR/$domain" ] ; then
echo "/usr/bin/rm -r $VMAIL_DIR/$domain" /usr/bin/rm -r $VMAIL_DIR/$domain
fi fi

View File

@ -117,19 +117,18 @@ else
fi fi
# add mbox # add mbox
# evail $dbcmd eval $dbcmd
echo $dbcmd
# create all required vmail dirs # create all required vmail dirs
if [ ! -d "/var/vmail/$domain" ] ; then if [ ! -d "/var/vmail/$domain" ] ; then
echo "install -o vmail -g vmail -m 750 -d /var/vmail/$domain" install -o vmail -g vmail -m 750 -d /var/vmail/$domain
fi fi
if [ ! -d "/var/vmail/$domain/$mbox" ] ; then if [ ! -d "/var/vmail/$domain/$mbox" ] ; then
echo "install -o vmail -g vmail -m 750 -d /var/vmail/$domain/$mbox" install -o vmail -g vmail -m 750 -d /var/vmail/$domain/$mbox
fi fi
if [ ! -d "/var/vmail/$domain/$mbox/Maildir" ] ; then if [ ! -d "/var/vmail/$domain/$mbox/Maildir" ] ; then
echo "install -o vmail -g vmail -m 750 -d /var/vmail/$domain/$mbox/Maildir" install -o vmail -g vmail -m 750 -d /var/vmail/$domain/$mbox/Maildir
fi fi
if [ ! -d "/var/vmail/$domain/$mbox/Maildir/cur" ] ; then if [ ! -d "/var/vmail/$domain/$mbox/Maildir/cur" ] ; then
echo "install -o vmail -g vmail -m 750 -d /var/vmail/$domain/$mbox/Maildir/cur" install -o vmail -g vmail -m 750 -d /var/vmail/$domain/$mbox/Maildir/cur
fi fi

View File

@ -72,19 +72,19 @@ if [ -z "$mboxes_id" ]; then
elif [ "$mboxes_id" -gt '0' ]; then elif [ "$mboxes_id" -gt '0' ]; then
if [ -n "$force" ] || vmail::yesno "Delete $email now?"; then if [ -n "$force" ] || vmail::yesno "Delete $email now?"; then
# this should be sufficient for vm_* tables due to ON DELETE CASCADE foreign key references # this should be sufficient for vm_* tables due to ON DELETE CASCADE foreign key references
dbquery="DELETE FROM vm_mboxes WHERE vm_mboxes.id='$mboxes_id'" dbquery="DELETE FROM vm_mboxes WHERE vm_mboxes.id='$mboxes_id';"
echo $dbcmd $dbcmdopts "\"$dbquery\"" eval $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM sa_userpref WHERE username='$email'" dbquery="DELETE FROM sa_userpref WHERE username='$email';"
echo $dbcmd $dbcmdopts "\"$dbquery\"" eval $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_greylisting WHERE recipient='$email'" dbquery="DELETE FROM vm_greylisting WHERE recipient='$email';"
echo $dbcmd $dbcmdopts "\"$dbquery\"" eval $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_greylisting WHERE recipient LIKE '$mbox+%@$domain'" dbquery="DELETE FROM vm_greylisting WHERE recipient LIKE '$mbox+%@$domain';"
echo $dbcmd $dbcmdopts "\"$dbquery\"" eval $dbcmd $dbcmdopts "\"$dbquery\""
# this should be sufficient for rc due to ON DELETE CASCADE foreign key references # this should be sufficient for rc due to ON DELETE CASCADE foreign key references
dbquery="DELETE FROM rc_users WHERE username='$email'" dbquery="DELETE FROM rc_users WHERE username='$email';"
echo $dbcmd $dbcmdopts "\"$dbquery\"" eval $dbcmd $dbcmdopts "\"$dbquery\""
if [ -d "$VMAIL_DIR/$domain/$mbox" ]; then if [ -d "$VMAIL_DIR/$domain/$mbox" ]; then
echo "rm -r $VMAIL_DIR/$domain/$mbox" rm -r $VMAIL_DIR/$domain/$mbox
fi fi
echo "SUCCESS: $email removed from system." echo "SUCCESS: $email removed from system."
exit 0 exit 0