Skip to content

Instantly share code, notes, and snippets.

@dakatsuka
Created December 15, 2013 10:57
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save dakatsuka/7971555 to your computer and use it in GitHub Desktop.
Save dakatsuka/7971555 to your computer and use it in GitHub Desktop.
/etc/init.d/mailcatcher
#!/bin/bash
PID_FILE=/var/run/mailcatcher.pid
NAME=mailcatcher
PROG=/opt/rbenv/versions/1.9.3-p484/bin/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
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
@ericrdb
Copy link

ericrdb commented Mar 16, 2014

Thanks so much for your work on this!

I need to add the --ip=x.x.x.x parameter to the upstart script. Any guidance you might offer? Cheers

@ericrdb
Copy link

ericrdb commented Mar 24, 2014

For those who find this later, this worked: https://gist.github.com/EHLOVader/9233230

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment