Subversion Repositories general

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1218 → Rev 1219

/hostadmiral/trunk/backend/delete_domain.sh
0,0 → 1,35
#!/bin/sh
 
#
# HostAdmiral backend. Executed with ROOT privileges
#
# The script deletes specified domain dir in mail spool
#
# Params:
# domain (e.g. example.com)
#
# Return:
# 0 - done
# 3 - wrong params
# 4 - some error
# 5 - error from system
#
 
### config ################################################
 
ROOT=/var/spool/mail
 
### validate params #######################################
 
if [ -z "$1" -o -n "$2" ] ; then echo "Wrong params 1"; exit 3; fi
 
DIR="/$1/"
echo "$DIR" | awk '$0 ~ "//" || $0 ~ "/\\./" || $0 ~ "/\\.\\./" || $0 !~ "^/(([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)\\.)*([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)/$" {exit 1} {exit 0}'
if [ $? -ne 0 ]; then
echo "Wrong params 2"; exit 3
fi
 
### work ##################################################
 
[ -d "${ROOT}${DIR}" ] && rmdir "${ROOT}${DIR}" || { echo "Cannot delete domain dir"; exit 5; }
 
Property changes:
Added: svn:executable
+*
\ No newline at end of property