Last active
August 29, 2015 14:19
-
-
Save lotsofcode/889909d4389154415ca4 to your computer and use it in GitHub Desktop.
py-serv.sh
This file contains 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 | |
port_param=$1 | |
port=${port_param:-5555} | |
function processId { | |
/bin/ps aux | grep "SimpleHTTPServer $port" | grep -v grep | awk '{print $2}' | |
} | |
# kill previous processes | |
processId | xargs kill -9 | |
# start the python server | |
/usr/bin/nohup /usr/bin/python -m SimpleHTTPServer $port >/dev/null 2>&1 & | |
# spit out the process id | |
echo -n "Server started on port $port, process id " | |
processId |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment