Added Greg's bash contrib script for running mailcatcher in screen

This commit is contained in:
Samuel Cochran 2011-04-05 10:33:26 +08:00
parent 2fdce6900a
commit d6c13f3d57
1 changed files with 35 additions and 0 deletions

35
contrib/mailcatcherd.bash Normal file
View File

@ -0,0 +1,35 @@
# mailcatchered: Start mailcatcher in a screen session
mailcatcherd() {
local check=`screen -list|grep mailcatcher|awk '{print $1}'`
if [[ "$1" = "" ]]; then
local hostname=""
if [[ $hostname = "" ]]; then
hostname='localhost'
fi
if [[ "${check}" = "" ]]; then
screen -dmS mailcatcher mailcatcher
echo "Started mailcatcher in background"
open "http://${hostname}:1080"
else
echo "mailcatcher is running in background..."
read -ep "re-attach(y/n) or run(r)?" choice
if [[ $choice = [yY] ]]; then
echo "Attaching mailcatcher session..."
screen -r $check
elif [[ $choice = [rR] ]]; then
open "http://${hostname}:1080"
else
echo "mailcatcher currently running at ${check}"
fi
fi
else
if [[ $1 -eq "load" ]]; then
screen -r mailcatcher
fi
fi
}