Skip to content
Snippets Groups Projects
install.sh 1003 B
Newer Older
Pierre Ozoux's avatar
Pierre Ozoux committed
#!/bin/bash

#judgement
if [[ -a /etc/supervisor/conf.d/supervisord.conf ]]; then
  exit 0
fi

#supervisor
cat > /etc/supervisor/conf.d/supervisord.conf <<EOF
[supervisord]
nodaemon=true

[program:postfix]
command=/opt/postfix.sh

[program:rsyslog]
command=/usr/sbin/rsyslogd -n
EOF

############
# postfix
############
cat >> /opt/postfix.sh <<EOF
#!/bin/bash
service postfix start
touch /var/log/mail.log
tail -f /var/log/mail.log
EOF
chmod +x /opt/postfix.sh

# put the same FQDN in /data/hostname and in reverse DNS
# for the public IP address on which this server will be
# receiving smtp traffic.
cp /data/hostname /etc/mailname
/usr/sbin/postconf -e "myhostname=`cat /data/hostname`"

# put all relevant domains in /data/destinations.
Pierre Ozoux's avatar
Pierre Ozoux committed
/usr/sbin/postconf -e "virtual_alias_domains=`cat /data/destinations`"
Pierre Ozoux's avatar
Pierre Ozoux committed

#put your forwarding addresses in /data/forwards.
Pierre Ozoux's avatar
Pierre Ozoux committed
cp /data/forwards /etc/postfix/virtual
/usr/sbin/postconf -e "virtual_alias_maps = hash:/etc/postfix/virtual"
Pierre Ozoux's avatar
Pierre Ozoux committed
postmap /etc/postfix/virtual