X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=osgi%2Fdist%2Fosgi-boot%2Fsrc%2Fmain%2Frpm%2Fusr%2Fsbin%2Fosgi-service;h=7d1ad6e5cd447df9d9579446da11e9d8c551b1e2;hb=9cd325a0243ffb9e290f7d5b13bbe0f0797b2207;hp=cbaecf5788cde451a084de527ded5b4bb4105da7;hpb=87a5c6c8c109097c8be2412f5a10df2de3a6e0c0;p=lgpl%2Fargeo-commons.git diff --git a/osgi/dist/osgi-boot/src/main/rpm/usr/sbin/osgi-service b/osgi/dist/osgi-boot/src/main/rpm/usr/sbin/osgi-service index cbaecf578..7d1ad6e5c 100644 --- a/osgi/dist/osgi-boot/src/main/rpm/usr/sbin/osgi-service +++ b/osgi/dist/osgi-boot/src/main/rpm/usr/sbin/osgi-service @@ -30,14 +30,17 @@ RETVAL=0 start() { cp $CONF_DIR/config.ini $CONF_RW/config.ini touch $SHUTDOWN_FILE - cd $EXEC_DIR && $JVM \ + cd $EXEC_DIR + $JVM \ -Dosgi.bundles="org.argeo.osgi.boot.jar@start" \ -Dargeo.osgi.bundles="$CONF_DIR/modules;in=*,$LIB_DIR;in=*" \ + -Dargeo.osgi.shutdownFile="$SHUTDOWN_FILE" \ -Dlog4j.configuration="file:$CONF_DIR/log4j.properties" \ $JAVA_OPTS -jar $OSGI_FRAMEWORK \ + -clean \ -configuration "$CONF_RW" \ -data "$DATA_DIR" \ - &> $LOG_FILE & + &>> $LOG_FILE & PID=$! echo $PID > $PID_FILE echo Started $APP with pid $PID @@ -45,9 +48,20 @@ start() { } stop() { - PID=`cat $PID_FILE` + if [ -f $PID_FILE ];then + PID=`cat $PID_FILE` + else + return $RETVAL + fi rm -f $SHUTDOWN_FILE - # TODO wait for process to finish until timeout, then kill + timeout 5m sh << EOF +while kill -0 $PID &> /dev/null; do sleep 1; done +EOF + TIMEOUT_EXIT=$? + if [ $TIMEOUT_EXIT -eq 124 ];then + kill -9 $PID + fi + rm -f $PID_FILE echo Stopped $APP with pid $PID return $RETVAL } @@ -60,21 +74,20 @@ case "$2" in stop) stop ;; - restart|reload) + restart) stop - sleep 10 start RETVAL=$? ;; - condrestart) - echo Not implemented - exit 1 - ;; status) - echo Not implemented - exit 1 + if [ -f $PID_FILE ];then + PID=`cat $PID_FILE` + echo $APP is running with pid $PID ... + else + echo $APP is not running + fi ;; *) - echo $"Usage: $0 {start|stop|restart}" + echo $"Usage: $0 {start|stop|restart|status}" exit 1 -esac +esac \ No newline at end of file