added servernameupdate function
This commit is contained in:
parent
15f4918258
commit
b6fcb25b3b
|
@ -109,7 +109,7 @@ del LOGIN [DBNAME]
|
||||||
list-vhost LOGIN
|
list-vhost LOGIN
|
||||||
|
|
||||||
List Apache vhost for user LOGIN
|
List Apache vhost for user LOGIN
|
||||||
|
|
||||||
check-vhosts -f
|
check-vhosts -f
|
||||||
List suggested changes to vhosts, apply fixes with -f
|
List suggested changes to vhosts, apply fixes with -f
|
||||||
|
|
||||||
|
@ -121,6 +121,10 @@ del-alias VHOST ALIAS
|
||||||
|
|
||||||
Del a ServerAlias from an Apache vhost
|
Del a ServerAlias from an Apache vhost
|
||||||
|
|
||||||
|
update-servername VHOST SERVERNAME
|
||||||
|
|
||||||
|
Update the ServerName from an Apache vhost
|
||||||
|
|
||||||
setphpversion LOGIN VERSION
|
setphpversion LOGIN VERSION
|
||||||
|
|
||||||
Change PHP version for LOGIN
|
Change PHP version for LOGIN
|
||||||
|
@ -261,7 +265,7 @@ create_www_account() {
|
||||||
${in_gid:+'--gid' "$in_gid"} \
|
${in_gid:+'--gid' "$in_gid"} \
|
||||||
--force-badname \
|
--force-badname \
|
||||||
--home "$HOME_DIR_USER" >/dev/null
|
--home "$HOME_DIR_USER" >/dev/null
|
||||||
|
|
||||||
[ -z "$in_sshkey" ] \
|
[ -z "$in_sshkey" ] \
|
||||||
&& echo "$in_login:$in_passwd" | chpasswd
|
&& echo "$in_login:$in_passwd" | chpasswd
|
||||||
|
|
||||||
|
@ -272,7 +276,7 @@ create_www_account() {
|
||||||
&& chmod -R u=rwX,g=,o= "$HOME_DIR_USER/.ssh/authorized_keys" \
|
&& chmod -R u=rwX,g=,o= "$HOME_DIR_USER/.ssh/authorized_keys" \
|
||||||
&& chown -R "$in_login":"$in_login" "$HOME_DIR_USER/.ssh"
|
&& chown -R "$in_login":"$in_login" "$HOME_DIR_USER/.ssh"
|
||||||
|
|
||||||
if [ "$WEB_SERVER" == "apache" ]; then
|
if [ "$WEB_SERVER" == "apache" ]; then
|
||||||
# Create www user and force UID if specified
|
# Create www user and force UID if specified
|
||||||
/usr/sbin/adduser \
|
/usr/sbin/adduser \
|
||||||
--gecos "WWW $in_login" \
|
--gecos "WWW $in_login" \
|
||||||
|
@ -486,25 +490,25 @@ EOT
|
||||||
|
|
||||||
if [ "$in_dbname" ]; then
|
if [ "$in_dbname" ]; then
|
||||||
sed -e "
|
sed -e "
|
||||||
s/LOGIN/$in_login/g ;
|
s/LOGIN/$in_login/g ;
|
||||||
s/SERVERNAME/$in_wwwdomain/ ;
|
s/SERVERNAME/$in_wwwdomain/ ;
|
||||||
s/PASSE1/$in_passwd/ ;
|
s/PASSE1/$in_passwd/ ;
|
||||||
s/PASSE2/$in_dbpasswd/ ;
|
s/PASSE2/$in_dbpasswd/ ;
|
||||||
s/RANDOM/$random/ ;
|
s/RANDOM/$random/ ;
|
||||||
s/QUOTA/$quota/ ;
|
s/QUOTA/$quota/ ;
|
||||||
s/RCPTTO/$in_mail/ ;
|
s/RCPTTO/$in_mail/ ;
|
||||||
s/DBNAME/$in_dbname/ ;
|
s/DBNAME/$in_dbname/ ;
|
||||||
s#HOME_DIR#$HOME_DIR#" \
|
s#HOME_DIR#$HOME_DIR#" \
|
||||||
< $TPL_MAIL | /usr/lib/sendmail -oi -t -f "$CONTACT_MAIL"
|
< $TPL_MAIL | /usr/lib/sendmail -oi -t -f "$CONTACT_MAIL"
|
||||||
else
|
else
|
||||||
sed -e "
|
sed -e "
|
||||||
s/LOGIN/$in_login/g ;
|
s/LOGIN/$in_login/g ;
|
||||||
s/SERVERNAME/$in_wwwdomain/ ;
|
s/SERVERNAME/$in_wwwdomain/ ;
|
||||||
s/PASSE1/$in_passwd/ ;
|
s/PASSE1/$in_passwd/ ;
|
||||||
s/RANDOM/$random/ ;
|
s/RANDOM/$random/ ;
|
||||||
s/QUOTA/$quota/ ;
|
s/QUOTA/$quota/ ;
|
||||||
s/RCPTTO/$in_mail/ ;
|
s/RCPTTO/$in_mail/ ;
|
||||||
s#HOME_DIR#$HOME_DIR# ;
|
s#HOME_DIR#$HOME_DIR# ;
|
||||||
39,58d" \
|
39,58d" \
|
||||||
< $TPL_MAIL | /usr/lib/sendmail -oi -t -f "$CONTACT_MAIL"
|
< $TPL_MAIL | /usr/lib/sendmail -oi -t -f "$CONTACT_MAIL"
|
||||||
fi
|
fi
|
||||||
|
@ -719,7 +723,7 @@ arg_processing() {
|
||||||
;;
|
;;
|
||||||
list-vhost)
|
list-vhost)
|
||||||
op_listvhost "$@"
|
op_listvhost "$@"
|
||||||
;;
|
;;
|
||||||
check-vhosts)
|
check-vhosts)
|
||||||
op_checkvhosts "$@"
|
op_checkvhosts "$@"
|
||||||
;;
|
;;
|
||||||
|
@ -729,6 +733,9 @@ arg_processing() {
|
||||||
del-alias)
|
del-alias)
|
||||||
op_aliasdel "$@"
|
op_aliasdel "$@"
|
||||||
;;
|
;;
|
||||||
|
update-servername)
|
||||||
|
op_servernameupdate "$@"
|
||||||
|
;;
|
||||||
setphpversion)
|
setphpversion)
|
||||||
op_setphpversion "$@"
|
op_setphpversion "$@"
|
||||||
;;
|
;;
|
||||||
|
@ -803,6 +810,20 @@ op_aliasdel() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
op_servernameupdate() {
|
||||||
|
if [ $# -eq 2 ]; then
|
||||||
|
vhost="${1}.conf"
|
||||||
|
servername=$2
|
||||||
|
|
||||||
|
[ -f $VHOST_PATH/"$vhost" ] && sed -i "s/ServerName .*/ServerName $servername/" $VHOST_PATH/"$vhost" --follow-symlinks
|
||||||
|
|
||||||
|
apache2ctl configtest 2>/dev/null
|
||||||
|
/etc/init.d/apache2 force-reload >/dev/null
|
||||||
|
|
||||||
|
else usage
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
op_add() {
|
op_add() {
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1006,7 +1027,7 @@ op_add() {
|
||||||
op_checkvhosts() {
|
op_checkvhosts() {
|
||||||
ln_vhosts_dir="$(sed 's/available/enabled/' <<< "$VHOST_PATH")"
|
ln_vhosts_dir="$(sed 's/available/enabled/' <<< "$VHOST_PATH")"
|
||||||
non_ln_vhosts="$(find "$ln_vhosts_dir"/* ! -type l)"
|
non_ln_vhosts="$(find "$ln_vhosts_dir"/* ! -type l)"
|
||||||
|
|
||||||
while getopts f opt; do
|
while getopts f opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
f)
|
f)
|
||||||
|
@ -1018,7 +1039,7 @@ op_checkvhosts() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
for ln_path in $non_ln_vhosts
|
for ln_path in $non_ln_vhosts
|
||||||
do
|
do
|
||||||
vhost_name=$(basename "$ln_path")
|
vhost_name=$(basename "$ln_path")
|
||||||
|
|
Loading…
Reference in a new issue