#! /bin/sh # Author: Jochen Roth # Provides: Netflix Vector # Description: Manage Netflix Vector init VECTOR_DIR=/usr/share/vector/ VECTOR_PORT=8080 case "$1" in start) cd $VECTOR_DIR/app && nohup python -m SimpleHTTPServer $VECTOR_PORT > /dev/null 2>&1 & echo $! > ../vector.pid ;; stop) KILL_PID=$(cat "$VECTOR_DIR/vector.pid") echo "kill $KILL_PID" kill $KILL_PID rm $VECTOR_DIR/vector.pid sleep 10 ;; restart) KILL_PID=$(cat "$VECTOR_DIR/vector.pid") echo "kill $KILL_PID" kill $KILL_PID rm $VECTOR_DIR/vector.pid sleep 20 cd $VECTOR_DIR/app && nohup python -m SimpleHTTPServer $VECTOR_PORT > /dev/null 2>&1 & echo $! > ../vector.pid ;; *) echo "Usage: Netflix vector {start|stop|restart}" >&2 exit 3 ;; esac