27 lines
850 B
Bash
27 lines
850 B
Bash
#!/bin/bash
|
|
#
|
|
# vhost-stack
|
|
# https://git.stack-source.com/msb/vhost-stack
|
|
# MIT License Copyright (c) 2021 Matthew Saunders Brown
|
|
|
|
# load config
|
|
source /etc/vhost.conf || echo "ERROR: Either you do not have vhost user permissions or the config file is missing." && exit
|
|
|
|
# check for and set virtualhost
|
|
if [ -n "$1" ]; then
|
|
virtualhost=$1
|
|
else
|
|
echo "virtualhost not set"
|
|
exit 1
|
|
fi
|
|
|
|
vhost::set-clusterNodes all
|
|
for n in "${clusterNodes[@]}"
|
|
do
|
|
if [ $n = `hostname -s` ]; then
|
|
[[ -h /etc/apache2/sites-enabled/$virtualhost.conf ]] && a2dissite --quiet $virtualhost && systemctl --quiet is-active apache2 && systemctl --quiet reload apache2
|
|
else
|
|
ssh $n.lan "[[ -h /etc/apache2/sites-enabled/$virtualhost.conf ]] && a2dissite --quiet $virtualhost && systemctl --quiet is-active apache2 && systemctl --quiet reload apache2"
|
|
fi
|
|
done
|