Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. set -eu
  4.  
  5. if [ $# != 1 ] ; then
  6. echo usage: $0 '<suffix>'
  7. exit 1
  8. fi
  9.  
  10. # the SUFFIX must not contain spaces or shell meta characters
  11. SUFFIX=$1
  12.  
  13. if [ -e /etc/apache2-$SUFFIX ] ; then
  14. echo ERROR: /etc/apache2-$SUFFIX already exists
  15. exit 2
  16. fi
  17.  
  18. echo Setting up /etc/apache2-$SUFFIX ...
  19. mkdir /etc/apache2-$SUFFIX
  20. ln -s /etc/apache2/*-available /etc/apache2-$SUFFIX
  21. cp -dp /etc/apache2/*-enabled /etc/apache2-$SUFFIX
  22. ln -s /etc/apache2/magic /etc/apache-$SUFFIX
  23. cp -dp /etc/apache2/{apache2.conf,envvars,ports.conf} /etc/apache2-$SUFFIX
  24.  
  25. echo Setting up /etc/init.d/apache2-$SUFFIX ...
  26. ln -s /etc/init.d/apache2 /etc/init.d/apache2-$SUFFIX
  27. ln -s /lib/systemd/system/apache2.service.d /lib/systemd/system/apache2-$SUFFIX.service.d
  28. /lib/systemd/system-generators/systemd-sysv-generator
  29.  
  30. echo -n Setting up symlinks:
  31. for $a in a2enmod a2dismod a2ensite a2dissite a2enconf a2disconf apache2ctl ; do
  32. echo -n " $a-$SUFFIX"
  33. ln -s /usr/sbin/$a /usr/local/sbin/$a-$SUFFIX
  34. done
  35.  
  36. echo Setting up /etc/logrotate.d/apache2-$SUFFIX and /var/log/apache2-$SUFFIX ...
  37. cp -a /etc/logrotate.d/apache2 /etc/logrotate.d/apache2-$SUFFIX
  38. perl -p -i -e s,apache2,apache2-$SUFFIX,g /etc/logrotate.d/apache2-$SUFFIX
  39. mkdir /var/log/apache2-$SUFFIX
  40. chmod 750 /var/log/apache2-$SUFFIX
  41. chown root:adm /var/log/apache2-$SUFFIX
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement