2021-04-04 13:28:22 -07:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# vhost-stack
|
|
|
|
# https://git.stack-source.com/msb/vhost-stack
|
|
|
|
# MIT License Copyright (c) 2021 Matthew Saunders Brown
|
|
|
|
|
2021-04-04 14:15:16 -07:00
|
|
|
# load include file
|
|
|
|
source $(dirname $0)/vhost.sh
|
2021-04-04 13:28:22 -07:00
|
|
|
|
|
|
|
if [ ! -f /etc/varnish/sites.d/example.com.vcl ]; then
|
|
|
|
|
|
|
|
echo "ERROR: example.vlc does not exist"
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
sitesArray=(`ls -1 /etc/varnish/sites.d/`)
|
|
|
|
truncate -s 0 /etc/varnish/sites.vcl
|
|
|
|
|
|
|
|
for site in "${sitesArray[@]}"
|
|
|
|
do
|
|
|
|
|
|
|
|
echo include \"sites.d/$site\"\; >> /etc/varnish/sites.vcl
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
exit 0
|