Switch to one Domtool principal
[hcoop/domtool2.git] / scripts / domtool-publish
CommitLineData
27e20924
AC
1#!/bin/sh -e
2
5543e924
AC
3redo_exim() {
4 /bin/echo -n "domainlist local_domains = " >/etc/exim4/conf.d/main/10_domtool-domains
5 /bin/cat /var/domtool/local_domains.cfg >>/etc/exim4/conf.d/main/10_domtool-domains
6 /bin/echo "" >>/etc/exim4/conf.d/main/10_domtool-domains
7 /bin/echo -n "domainlist relay_to_domains = " >>/etc/exim4/conf.d/main/10_domtool-domains
8 /bin/cat /var/domtool/relay_domains.cfg >>/etc/exim4/conf.d/main/10_domtool-domains
9 /bin/echo "" >>/etc/exim4/conf.d/main/10_domtool-domains
10 /bin/echo -n "domainlist mm_domains = " >>/etc/exim4/conf.d/main/10_domtool-domains
11 /bin/cat /var/domtool/mailman_domains.cfg >>/etc/exim4/conf.d/main/10_domtool-domains
12 /bin/echo "" >>/etc/exim4/conf.d/main/10_domtool-domains
13 /etc/init.d/exim4 reload
14}
15
27e20924
AC
16case $1 in
17 apache)
71ba8736 18 /usr/bin/rsync -r --delete /var/domtool/vhosts/ /etc/apache2/vhosts/
35aca644 19 /etc/init.d/apache2 reload
27e20924 20 ;;
8e965b2d
AC
21 apache-down)
22 /etc/init.d/apache2 stop
23 ;;
24 apache-undown)
71ba8736 25 /usr/bin/rsync -r --delete /var/domtool/vhosts/ /etc/apache2/vhosts/
8e965b2d
AC
26 /etc/init.d/apache2 start
27 ;;
55d4a268
AC
28 apache1.3)
29 /usr/bin/rsync -r --delete /var/domtool/vhosts/ /etc/apache/vhosts/
30 /etc/init.d/apache reload
31 ;;
32 apache1.3-down)
33 /etc/init.d/apache stop
34 ;;
35 apache1.3-undown)
36 /usr/bin/rsync -r --delete /var/domtool/vhosts/ /etc/apache/vhosts/
37 /etc/init.d/apache start
38 ;;
27e20924 39 bind)
71ba8736 40 /usr/bin/rsync -r --delete /var/domtool/zones/ /etc/bind/zones/
6b1ff6b1 41 /bin/chown -R bind /etc/bind/zones
27e20924 42 /bin/cp /var/domtool/named.conf.local /etc/bind/
6b1ff6b1 43 /bin/chown root:bind_config /etc/bind/named.conf.local
050655b6 44 /bin/chmod u=rw,g=rw,o=r /etc/bind/named.conf.local
35aca644 45 /etc/init.d/bind9 reload
27e20924
AC
46 ;;
47 exim)
80fb3843
AC
48 /bin/cp /var/domtool/aliases /etc/aliases.hosted
49 #/bin/cp /var/domtool/aliases.default /etc/
5543e924 50 redo_exim
27e20924
AC
51 ;;
52 mailman)
53 /bin/cp /var/domtool/mailman.map /etc/mailman
35aca644 54 /etc/init.d/mailman reload
5543e924 55 redo_exim
27e20924 56 ;;
08688401 57 courier)
7aa78013 58 /usr/sbin/makeuserdb
dee1a22b 59 /bin/chown -R domtool.domtool /etc/courier/userdb
2bc5ed22
AC
60 /bin/cat /etc/courier/userdb/* >/etc/courier/exim
61 /bin/chmod o-r /etc/courier/exim
62 /usr/sbin/exim_dbmbuild /etc/courier/exim /etc/courier/exim.dat
63 /bin/chgrp mail /etc/courier/exim.dat
64 /bin/chmod o-r /etc/courier/exim.dat
65 ;;
66 smtplog)
67 /bin/grep $2 /var/log/exim4/mainlog
08688401 68 ;;
27e20924 69 *)
192bfb21 70 echo "Usage: domtool-publish [apache|bind|courier|exim|mailman|smtplog STRING]"
27e20924 71 ;;
51be7da6 72esac