# inbucket - disposable email service
#
# Inbucket is an SMTP server with a web interface for testing application
# functionality

description "inbucket - disposable email service"
author      "http://jhillyerd.github.com/inbucket"

start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]

env program=/opt/inbucket/inbucket
env config=/etc/opt/inbucket.conf
env logfile=/var/log/inbucket.log
env runas=inbucket

# Give SMTP connections time to drain
kill timeout 20

pre-start script
  [ -x $program ]
  [ -r $config ]
  touch $logfile
  chown $runas: $logfile
  # Allow bind to ports under 1024
  setcap 'cap_net_bind_service=+ep' $program
end script

exec start-stop-daemon --start --chuid $runas --exec $program -- -logfile $logfile $config
