3d3b23bb00573c2ffb12d00c61915dcfd645fcad
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
16 JAR
=/path
/to
/fanfix.jar
22 ERR
=/var
/log
/fanfix.err
24 if [ "$ENABLED" != true
]; then
29 if [ ! -e "$JAR" ]; then
30 echo "Canot find main jar file: $JAR" >&2
36 if sh
"$0" status
--quiet; then
37 echo "Fanfix is already running." >&2
40 [ -e "$OUT" ] && mv "$OUT" "$OUT".previous
41 [ -e "$ERR" ] && mv "$ERR" "$ERR".previous
42 sudo
-u "$USER" -- java
-jar "$JAR" --server "$PINCODE" "$PORT" > "$OUT" 2> "$ERR" &
47 sh
"$0" status
--quiet
50 if sh
"$0" status
--quiet; then
51 sudo
-u "$USER" -- java
-jar "$JAR" --stop-server "$PINCODE" "$PORT"
55 while [ $i -lt 100 ]; do
56 if sh
"$0" status
--quiet; then
64 if sh
"$0" status
--quiet; then
65 echo "Process not responding, killing it..." >&2
68 kill -9 "`cat "$FPID"`" 2>/dev
/null
78 if [ -e "$FPID" ]; then
79 if [ "$2" = "--quiet" ]; then
80 ps
"`cat "$FPID"`" >/dev
/null
82 ps
"`cat "$FPID"`" >/dev
/null \
83 && echo service is running
>&2
90 echo $
"Usage: $0 {start|stop|status|restart}" >&2