Last active
May 16, 2018 10:14
-
-
Save tknr/aebf61f161ae06c3d71e8d22bd6c788c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
### BEGIN INIT INFO | |
# Provides: maildev | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Maildev | |
# Description: This file starts and stops Maildev server | |
# | |
### END INIT INFO | |
# /etc/init.d/maildev | |
case "$1" in | |
start) | |
$(which maildev) -s 1025 -w 1080 & | |
;; | |
stop) | |
kill -9 $(ps ax |grep $(which maildev) |grep -v grep |awk '{print $1}') 2> /dev/null | |
sleep 1 | |
;; | |
restart) | |
kill -9 $(ps ax |grep $(which maildev) |grep -v grep |awk '{print $1}') 2> /dev/null | |
sleep 2 | |
$(which maildev) -s 1025 -w 1080 & | |
;; | |
status) | |
ps ax |grep $(which maildev) |grep -v grep > /dev/null | |
if [ $? = 0 ]; then | |
echo maildev is running. | |
else | |
echo maildev is not running. | |
fi | |
;; | |
*) | |
echo "Usage: maildev {start|stop|restart}" >&2 | |
exit 3 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment