use quotes

This commit is contained in:
j 2016-01-18 13:07:59 +05:30
parent 25ce4c03e1
commit f61a3926e6

22
ctl
View file

@ -19,14 +19,14 @@ else
mv "$BASE/config/release.json" "$BASE/data/release.json"
fi
fi
if [ ! -e $PID ]; then
if [ ! -e "$PID" ]; then
if [ -e "$DATA/tor/hostname" ]; then
onion=$(cat "$DATA/tor/hostname")
id=${onion/.onion/}
PID="/tmp/$NAME.$USER.$id.pid"
fi
fi
if [ ! -e $PID ]; then
if [ ! -e "$PID" ]; then
PID="$DATA/$NAME.pid"
fi
@ -85,31 +85,31 @@ function remove_autostart {
if [ "$1" == "start" ]; then
remove_autostart
cd "$BASE/$NAME"
if [ -e $PID ]; then
if [ -e "$PID" ]; then
if ps -p `cat "$PID"` > /dev/null; then
echo openmedialibrary already running
exit 1
fi
fi
python3 oml server $PID
python3 oml server "$PID"
exit $?
fi
if [ "$1" == "debug" ]; then
cd "$BASE/$NAME"
if [ -e $PID ]; then
if [ -e "$PID" ]; then
if ps -p `cat "$PID"` > /dev/null; then
echo openmedialibrary already running
exit 1
fi
fi
shift
python3 oml server debug $PID
python3 oml server debug "$PID"
exit $?
fi
if [ "$1" == "stop" ]; then
remove_autostart
if [ -e $PID ]; then
_PID=`cat $PID`
if [ -e "$PID" ]; then
_PID=`cat "$PID"`
kill $_PID
waited=0
while ps -p $_PID > /dev/null
@ -121,12 +121,12 @@ if [ "$1" == "stop" ]; then
sleep 1
fi
done
test -e $PID && rm $PID
test -e "$PID" && rm "$PID"
fi
exit $?
fi
if [ "$1" == "restart" ]; then
if [ -e $PID ]; then
if [ -e "$PID" ]; then
"$0" stop
"$0" start
exit $?
@ -140,7 +140,7 @@ if [ "$1" == "open" ]; then
open "/Applications/Open Media Library.app"
fi
if [ $SYSTEM == "Linux" ]; then
if [ -e $PID ]; then
if [ -e "$PID" ]; then
if ps -p `cat "$PID"` > /dev/null; then
xdg-open "file://${BASE}/openmedialibrary/static/html/load.html"
else