diff --git a/bin/inbucket-redhat-init.sh b/bin/inbucket-redhat-init.sh new file mode 100755 index 0000000..e1daa7b --- /dev/null +++ b/bin/inbucket-redhat-init.sh @@ -0,0 +1,102 @@ +#!/bin/sh +# +# inbucket Inbucket email testing service +# +# chkconfig: 2345 80 30 +# description: Inbucket is a disposable email service for testing email +# functionality of other applications. +# processname: inbucket +# pidfile: /var/run/inbucket/inbucket.pid + +### BEGIN INIT INFO +# Provides: Inbucket service +# Required-Start: $local_fs $network $remote_fs +# Required-Stop: $local_fs $network $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: start and stop inbucket +# Description: Inbucket is a disposable email service for testing email +# functionality of other applications. +# moves mail from one machine to another. +### END INIT INFO + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +RETVAL=0 +program=/opt/inbucket/inbucket +prog=${program##*/} +config=/opt/inbucket/etc/inbucket.conf +runas=inbucket + +lockfile=/var/lock/subsys/$prog +pidfile=/var/run/$prog/$prog.pid +logfile=/var/log/$prog.log + +conf_check() { + [ -x $program ] || exit 5 + [ -f $config ] || exit 6 +} + +perms_check() { + mkdir -p /var/run/$prog + chown $runas: /var/run/$prog + touch $logfile + chown $runas: $logfile +} + +start() { + [ "$EUID" != "0" ] && exit 4 + # Check that networking is up. + [ ${NETWORKING} = "no" ] && exit 1 + # Check config sanity + conf_check + perms_check + # Start daemon + echo -n $"Starting $prog: " + daemon --user $runas --pidfile $pidfile $program \ + -pidfile $pidfile -logfile $logfile $config \& + RETVAL=$? + [ $RETVAL -eq 0 ] && touch $lockfile + echo + return $RETVAL +} + +stop() { + [ "$EUID" != "0" ] && exit 4 + conf_check + # Stop daemon + echo -n $"Shutting down $prog: " + killproc -p "$pidfile" -d 15 "$program" + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile + echo + return $RETVAL +} + +# See how we were called. +case "$1" in + start) + [ -e $lockfile ] && exit 0 + start + ;; + stop) + [ -e $lockfile ] || exit 0 + stop + ;; + restart|force-reload) + stop + start + ;; + status) + status -p $pidfile -l $(basename $lockfile) $prog + ;; + *) + echo $"Usage: $0 {start|stop|restart|status}" + exit 2 +esac + +exit $? diff --git a/etc/unix-sample.conf b/etc/unix-sample.conf new file mode 100644 index 0000000..33e9a0f --- /dev/null +++ b/etc/unix-sample.conf @@ -0,0 +1,78 @@ +# inbucket.conf +# Sample inbucket configuration + +############################################################################# +[DEFAULT] + +# Not used by directly, but is typically referenced below in %()s format. +install.dir=/opt/inbucket + +############################################################################# +[logging] + +# Options from least to most verbose: ERROR, WARN, INFO, TRACE +level=INFO + +############################################################################# +[smtp] + +# IPv4 address to listen for SMTP connections on. +ip4.address=0.0.0.0 + +# IPv4 port to listen for SMTP connections on. +ip4.port=2500 + +# used in SMTP greeting +domain=inbucket.local + +# Maximum number of RCPT TO: addresses we allow from clients, the SMTP +# RFC recommends this be at least 100. +max.recipients=100 + +# How long we allow a network connection to be idle before hanging up on the +# client, SMTP RFC recommends at least 5 minutes (300 seconds). +max.idle.seconds=300 + +# Maximum allowable size of message body in bytes (including attachments) +max.message.bytes=2048000 + +# Should we place messages into the datastore, or just throw them away +# (for load testing): true or false +store.messages=true + +############################################################################# +[web] + +# IPv4 address to serve HTTP web interface on +ip4.address=0.0.0.0 + +# IPv4 port to serve HTTP web interface on +ip4.port=9000 + +# Name of web theme to use +theme=integral + +# Path to the selected themes template files +template.dir=%(install.dir)s/themes/%(theme)s/templates + +# Should we cache parsed templates (set to false during theme dev) +template.cache=true + +# Path to the selected themes public (static) files +public.dir=%(install.dir)s/themes/%(theme)s/public + +############################################################################# +[datastore] + +# Path to the datastore, mail will be written into subdirectories +path=/var/opt/inbucket + +# How many minutes after receipt should a message be stored until it's +# automatically purged. To retain messages until manually deleted, set this +# to 0 +retention.minutes=240 + +# How many milliseconds to sleep after purging messages from a mailbox. +# This should help reduce disk I/O when there are a large number of messages +# to purge. +retention.sleep.millis=100