--- /dev/null
+#!/bin/sh
+self=$0
+if [ -L "$self" ]; then
+ self=$(readlink -f "$0")
+fi
+sock=$(dirname "$self")/request_handler_server.sock
+daemon=0
+attach=0
+
+if [ x"$1" = x"--daemon" -o x"$1" = x"-d" ]; then
+ daemon=1
+fi
+if [ x"$1" = x"--attach" -o x"$1" = x"-a" ]; then
+ attach=1
+fi
+
+if [ ! -S $sock ]; then
+ daemon=1
+fi
+
+# if none of the modes attach to it
+if [ $daemon = 0 -a $attach = 0 ]; then
+ attach=1
+fi
+
+if [ "$daemon" = 1 ]; then
+ echo "Starting request_handler_server(s)"
+ rm -f $sock
+ cd $(dirname $sock)
+ tmux -S $sock new-session -d -s "request_handler_server" -n "http" "python request_handler_server.py" && \
+ exec tmux -S $sock new-window -d -t "request_handler_server" -n "https" "python request_handler_server.py ssl"
+ exit 1
+fi
+
+# attach to session
+if [ "$attach" = 1 ]; then
+ echo "Attaching to request_handler_server(s)"
+ exec tmux -S $sock attach
+ exit 1
+fi