#!/bin/sh
# Start/stop airproxy server
EXECDIR=/usr/local/bin/airproxy050/
JAVA=/usr/bin/java
USER=airproxy
NAME=airproxy
DESC="airproxy server"
start() {
echo -n "Starting $DESC: "
if start-stop-daemon --stop --quiet \
--signal 0 --user $USER --exec $JAVA
then
echo "already running."
return 1
else
start-stop-daemon --chuid $USER --start --quiet --chdir $EXECDIR \
--user $USER --exec $JAVA -- -Djava.library.path=/usr/local/lib \
-jar airproxy.jar >& /var/log/airproxy/err.log &
echo "$NAME."
return 0
fi
}
stop() {
echo -n "Stoping $DESC: "
if start-stop-daemon --stop --quiet \
--signal 0 --user $USER --exec $JAVA
then
start-stop-daemon --stop --quiet \
--signal 15 --user $USER --exec $JAVA
echo "$NAME."
return 0
else
echo "not running."
return 1
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 5
start
;;
*)
echo -n "Usage $NAME {start|stop|restart}"
echo
;;
esac
0 件のコメント:
コメントを投稿