]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - dist/osgi-boot/src/main/rpm/usr/sbin/osgi-service
2ce1b61c20df4d6eed4cb3ff2af213747c1f7faa
4 .
/etc
/osgiboot
/osgi-service-settings.sh
9 if [ -f $CONF_DIR/settings.sh
];then
10 .
$CONF_DIR/settings.sh
13 LIB_DIR
=/usr
/share
/$APP/lib
16 EXEC_DIR
=/var
/lib
/$APP
17 DATA_DIR
=$EXEC_DIR/data
18 CONF_RW
=$EXEC_DIR/conf
21 LOG_FILE
=$LOG_DIR/$APP.log
24 PID_FILE
=$RUN_DIR/$APP.pid
25 SHUTDOWN_FILE
=$RUN_DIR/$APP.shutdown
27 OSGI_INSTALL_AREA
=/usr
/share
/osgi
/boot
28 OSGI_FRAMEWORK
=$OSGI_INSTALL_AREA/org.eclipse.osgi.jar
33 if [ -f $PID_FILE ];then
35 kill -0 $PID &> /dev
/null
37 if [ $PID_EXISTS -eq 0 ]; then
38 echo $APP already running with pid
$PID
42 echo Old
$APP process with pid
$PID is dead
, removing
$PID_FILE
47 if [ ! -f $CONF_RW/config.ini
]; then
48 #echo osgi.configuration.cascaded=true > $CONF_RW/config.ini
49 #echo osgi.sharedConfiguration.area=$CONF_DIR >> $CONF_RW/config.ini
50 #echo osgi.sharedConfiguration.area.readOnly=true >> $CONF_RW/config.ini
51 cp --preserve $CONF_DIR/config.ini
$CONF_RW/config.ini
56 -Dargeo.osgi.shutdownFile
="$SHUTDOWN_FILE" \
57 -Dlog4j.configuration
="file:$CONF_DIR/log4j.properties" \
58 -Djava.security.manager
= \
59 -Djava.security.policy
="file:/etc/osgiboot/all.policy" \
60 $JAVA_OPTS -jar $OSGI_FRAMEWORK \
62 -configuration "$CONF_RW" \
65 # (above) stderr redirected to stdout, then stdout to log file
66 # see http://tldp.org/LDP/abs/html/io-redirection.html
69 #echo Started $APP with pid $PID
74 if [ -f $PID_FILE ];then
76 kill -0 $PID &> /dev
/null
78 if [ $PID_EXISTS -ne 0 ]; then
79 echo Dead
$APP process with pid
$PID, removing
$PID_FILE
85 echo $APP is not running
90 # notifies application by removing the shutdown file
93 # wait 5 min for application to shutdown, then kill it
96 while kill -0 $PID &> /dev
/null
100 DURATION
=$
(($NOW-$BEGIN))
101 if [ $DURATION -gt $TIMEOUT ]; then
103 echo Forcibly killed
$APP with pid
$PID
112 # timeout is only available in EL6
113 # timeout 5m sh << EOF
114 #while kill -0 $PID &> /dev/null; do sleep 1; done
117 # if [ $TIMEOUT_EXIT -eq 124 ];then
120 # echo Killed $APP with pid $PID
122 # echo Stopped $APP with pid $PID
129 if [ -f $PID_FILE ];then
132 echo $APP is not running
135 kill -0 $PID &> /dev
/null
137 if [ $PID_EXISTS -eq 0 ]; then
138 echo $APP is running with pid
$PID ...
140 echo No
$APP process with pid
$PID, removing
$PID_FILE
158 echo $
"Usage: $0 {start|stop|status}"