Skip to content

Instantly share code, notes, and snippets.

@Bouhnosaure
Forked from EHLOVader/mailcatcher.sh
Last active March 30, 2016 13:44
Show Gist options
  • Save Bouhnosaure/49d733254d11d4240364 to your computer and use it in GitHub Desktop.
Save Bouhnosaure/49d733254d11d4240364 to your computer and use it in GitHub Desktop.
#!/bin/bash
PID_FILE=/var/run/mailcatcher.pid
NAME=mailcatcher
PROG="/usr/bin/env mailcatcher"
USER=mailcatcher
GROUP=mailcatcher
start() {
echo -n "Starting MailCatcher"
if start-stop-daemon --stop --quiet --pidfile $PID_FILE --signal 0
then
echo " already running."
exit
fi
start-stop-daemon \
--start \
--pidfile $PID_FILE \
--make-pidfile \
--background \
--exec $PROG \
--user $USER \
--group $GROUP \
--chuid $USER \
-- \
--foreground \
--http-ip=0.0.0.0 \
--http-port=22080 \
--http-ip=0.0.0.0 \
--smtp-port=22025
echo "."
return $?
}
stop() {
echo -n "Stopping MailCatcher"
start-stop-daemon \
--stop \
--oknodo \
--pidfile $PID_FILE
echo "."
return $?
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment