View Single Post
Posts: 230 | Thanked: 302 times | Joined on Oct 2009 @ Helsinki, Suomi (Finland)
#10
@Schturman
In above post there was all you needed to know.

Code:
#!/bin/sh
pid=`pgrep -f SimpleHTTPServer`
dir="/home/user/MyDocs/Movies"

if [ -z $pid ]
then
        cd $dir
        develsh -c "python -m SimpleHTTPServer 80"
else
        kill $pid
fi
Basically you just check if the process does not exist ($pid lenght is zero), if true run python SimpleHTTPServer, else kill the process. There's no need to use httpshare script as you're not using any of it's functionality.

Last edited by ladoga; 2013-01-02 at 00:13.