3 # fanfix This starts the Fanfix remote service.
5 # description: Starts the Fanfix remote service
9 # Short-Description: Fanfix service
10 # Description: Starts the Fanfix remote service
15 JAR
=/path
/to
/fanfix.jar
19 ERR
=/var
/log
/fanfix.err
21 if [ "$ENABLED" != true
]; then
26 if [ ! -e "$JAR" ]; then
27 echo "Canot find main jar file: $JAR" >&2
33 if sh
"$0" status
--quiet; then
34 echo "Fanfix is already running." >&2
37 [ -e "$OUT" ] && mv "$OUT" "$OUT".previous
38 [ -e "$ERR" ] && mv "$ERR" "$ERR".previous
39 sudo
-u "$USER" -- java
-jar "$JAR" --server > "$OUT" 2> "$ERR" &
44 sh
"$0" status
--quiet
47 if sh
"$0" status
--quiet; then
48 sudo
-u "$USER" -- java
-jar "$JAR" --stop-server
52 while [ $i -lt 100 ]; do
53 if sh
"$0" status
--quiet; then
61 if sh
"$0" status
--quiet; then
62 echo "Process not responding, killing it..." >&2
65 kill -9 "`cat "$FPID"`" 2>/dev
/null
75 if [ -e "$FPID" ]; then
76 if [ "$2" = "--quiet" ]; then
77 ps
"`cat "$FPID"`" >/dev
/null
79 ps
"`cat "$FPID"`" >/dev
/null \
80 && echo service is running
>&2
87 echo $
"Usage: $0 {start|stop|status|restart}" >&2