USER=root
PID_PATH=/var/run/
PROJECT_ROOT=/opt/hudson
JAR_FILE=/opt/hudson/slave.jar
HUDSON="-jnlpUrl http://server:port/computer/linux-1/slave-agent.jnlp"
EXCEPTION="Usage: jss {start|stop|restart}"
RETVAL=0
PID_FILE=$PID_PATH/hudson.pid
# PREPARE JAR FILE
if [ ! -e $JAR_FILE ]
then
cd $PROJECT_ROOT
ant
fi
# DEFINE STARTUP & ENDUP
start() {
echo -n "Starting JSS, MODE: $MODE"
start-stop-daemon -b --start --quiet -m -p $PID_FILE --chuid $USER --exec /usr/bin/java -- -jar $JAR_FILE $HUDSON
RETVAL=$?
echo "DONE."
}
stop() {
echo -n "Stopping JSS, MODE: $MODE"
start-stop-daemon --stop --quiet -p $PID_FILE
rm -f $PID_FILE
RETVAL=$?
echo "DONE."
}
# COMMANDS
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 2
start
;;
*)
echo $EXCEPTION
exit 1
;;
esac
exit $RETVAL
PID_PATH=/var/run/
PROJECT_ROOT=/opt/hudson
JAR_FILE=/opt/hudson/slave.jar
HUDSON="-jnlpUrl http://server:port/computer/linux-1/slave-agent.jnlp"
EXCEPTION="Usage: jss {start|stop|restart}"
RETVAL=0
PID_FILE=$PID_PATH/hudson.pid
# PREPARE JAR FILE
if [ ! -e $JAR_FILE ]
then
cd $PROJECT_ROOT
ant
fi
# DEFINE STARTUP & ENDUP
start() {
echo -n "Starting JSS, MODE: $MODE"
start-stop-daemon -b --start --quiet -m -p $PID_FILE --chuid $USER --exec /usr/bin/java -- -jar $JAR_FILE $HUDSON
RETVAL=$?
echo "DONE."
}
stop() {
echo -n "Stopping JSS, MODE: $MODE"
start-stop-daemon --stop --quiet -p $PID_FILE
rm -f $PID_FILE
RETVAL=$?
echo "DONE."
}
# COMMANDS
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 2
start
;;
*)
echo $EXCEPTION
exit 1
;;
esac
exit $RETVAL