postfix.sh 406 B

12345678910111213141516
  1. #!/bin/bash
  2. trap "postfix stop" EXIT
  3. sed -i "/^user/c\user = ${DBUSER}" /opt/postfix/conf/sql/*
  4. sed -i "/^password/c\password = ${DBPASS}" /opt/postfix/conf/sql/*
  5. sed -i "/^dbname/c\dbname = ${DBNAME}" /opt/postfix/conf/sql/*
  6. postconf -c /opt/postfix/conf
  7. if [[ $? != 0 ]]; then
  8. echo "Postfix configuration error, refusing to start."
  9. exit 1
  10. else
  11. postfix -c /opt/postfix/conf start
  12. sleep infinity
  13. fi