Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- set -eu
- if [ $# != 1 ] ; then
- echo usage: $0 '<suffix>'
- exit 1
- fi
- # the SUFFIX must not contain spaces or shell meta characters
- SUFFIX=$1
- if [ -e /etc/apache2-$SUFFIX ] ; then
- echo ERROR: /etc/apache2-$SUFFIX already exists
- exit 2
- fi
- echo Setting up /etc/apache2-$SUFFIX ...
- mkdir /etc/apache2-$SUFFIX
- ln -s /etc/apache2/*-available /etc/apache2-$SUFFIX
- cp -dp /etc/apache2/*-enabled /etc/apache2-$SUFFIX
- ln -s /etc/apache2/magic /etc/apache-$SUFFIX
- cp -dp /etc/apache2/{apache2.conf,envvars,ports.conf} /etc/apache2-$SUFFIX
- echo Setting up /etc/init.d/apache2-$SUFFIX ...
- ln -s /etc/init.d/apache2 /etc/init.d/apache2-$SUFFIX
- ln -s /lib/systemd/system/apache2.service.d /lib/systemd/system/apache2-$SUFFIX.service.d
- /lib/systemd/system-generators/systemd-sysv-generator
- echo -n Setting up symlinks:
- for $a in a2enmod a2dismod a2ensite a2dissite a2enconf a2disconf apache2ctl ; do
- echo -n " $a-$SUFFIX"
- ln -s /usr/sbin/$a /usr/local/sbin/$a-$SUFFIX
- done
- echo Setting up /etc/logrotate.d/apache2-$SUFFIX and /var/log/apache2-$SUFFIX ...
- cp -a /etc/logrotate.d/apache2 /etc/logrotate.d/apache2-$SUFFIX
- perl -p -i -e s,apache2,apache2-$SUFFIX,g /etc/logrotate.d/apache2-$SUFFIX
- mkdir /var/log/apache2-$SUFFIX
- chmod 750 /var/log/apache2-$SUFFIX
- chown root:adm /var/log/apache2-$SUFFIX
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement