Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/v-change-web-domain-backend-tpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ is_backend_template_valid $template
prepare_web_backend

# Deleting backend
rm -f $pool/$backend_type.conf
delete_web_backend

# Allocating backend port
backend_port=9000
Expand Down
2 changes: 1 addition & 1 deletion bin/v-delete-web-domain-backend
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if [ "$WEB_BACKEND_POOL" = 'user' ]; then
fi

# Deleting backend
rm -f $pool/$backend_type.conf
delete_web_backend


#----------------------------------------------------------#
Expand Down
4 changes: 2 additions & 2 deletions bin/v-rebuild-web-domains
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ fi
if [ ! -z "$WEB_BACKEND" ]; then
if [ "$WEB_BACKEND_POOL" = 'user' ]; then
prepare_web_backend
rm -f $pool/$backend_type.conf
delete_web_backend
else
for domain in $($BIN/v-list-web-domains $user plain |cut -f 1); do
prepare_web_backend
rm -f $pool/$backend_type.conf
delete_web_backend
done
fi
fi
Expand Down
15 changes: 9 additions & 6 deletions bin/v-restart-web-backend
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ if [ -z "$WEB_BACKEND" ] || [ "$WEB_BACKEND" = 'remote' ]; then
fi

# Restart system
php_fpm=$(ls /etc/init.d/php*-fpm* 2>/dev/null |cut -f 4 -d / |head -n 1)
if [ -z "$php_fpm" ]; then
service $WEB_BACKEND restart >/dev/null 2>&1
else
service $php_fpm restart >/dev/null 2>&1
fi
php_fpm=$(ls /etc/init.d/php*-fpm* 2>/dev/null |cut -f 4 -d /)
for back in $php_fpm
do
if [ -z "$php_fpm" ]; then
service $WEB_BACKEND restart >/dev/null 2>&1
else
service $back restart >/dev/null 2>&1
fi
done

if [ $? -ne 0 ]; then
send_email_report
Expand Down
27 changes: 26 additions & 1 deletion func/domain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,27 @@ is_web_alias_new() {

# Prepare web backend
prepare_web_backend() {
pool=$(find -L /etc/php* -type d \( -name "pool.d" -o -name "*fpm.d" \))
pool=$(find -L /etc/php/ -name "$domain.conf" -exec dirname {} \;)

#
# Check if multiple-PHP installed
#
regex="socket-(\d+)_(\d+)"
if [[ $template =~ ^socket-([0-9])\_([0-9])$ ]]
then
version="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
pool=$(find -L /etc/php/$version -type d \( -name "pool.d" -o -name "*fpm.d" \))
else
if [ "$pool" == "" ]
then
version=`echo "<?php echo (float)phpversion();" | php`
pool=$(find -L /etc/php/$version -type d \( -name "pool.d" -o -name "*fpm.d" \))
fi
fi
#
# /Check if multiple-PHP installed
#

if [ ! -e "$pool" ]; then
check_result $E_NOTEXIST "php-fpm pool doesn't exist"
fi
Expand All @@ -102,6 +122,11 @@ prepare_web_backend() {
fi
}

# Delete web backend
delete_web_backend() {
find -L /etc/php/ -type f -name "$backend_type.conf" -exec rm -f {} \;
}

# Prepare web aliases
prepare_web_aliases() {
i=1
Expand Down