3 # fanfix This starts the Fanfix remote service.
5 # chkconfig: 2345 10 90
6 # 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 sudo
-u "$USER" -- java
-jar "$JAR" --server "$PINCODE" "$PORT" > "$OUT" 2> "$ERR" &
45 sh
"$0" status
--quiet
48 if sh
"$0" status
--quiet; then
49 sudo
-u "$USER" -- java
-jar "$JAR" --stop-server "$PINCODE" "$PORT"
53 while [ $i -lt 100 ]; do
54 if sh
"$0" status
--quiet; then
62 if sh
"$0" status
--quiet; then
63 echo "Process not responding, killing it..." >&2
66 kill -9 "`cat "$FPID"`" 2>/dev
/null
76 if [ -e "$FPID" ]; then
77 if [ "$2" = "--quiet" ]; then
78 ps
"`cat "$FPID"`" >/dev
/null
80 ps
"`cat "$FPID"`" >/dev
/null \
81 && echo service is running
>&2
88 echo $
"Usage: $0 {start|stop|status|restart}" >&2