Fixed setup and installation script.

This commit is contained in:
Heng Sin Low 2012-06-20 16:58:04 +08:00
parent 61e6324fee
commit bafafa3239
19 changed files with 101 additions and 297 deletions

View File

@ -58,10 +58,6 @@
<copy file="utils/myEnvironmentTemplate.bat" <copy file="utils/myEnvironmentTemplate.bat"
tofile="utils/myEnvironment.bat" filtering="yes" overwrite="yes" /> tofile="utils/myEnvironment.bat" filtering="yes" overwrite="yes" />
<copy file="utils/RUN_GetAdempiereTemplate.bat"
tofile="utils/RUN_GetAdempiere.bat" filtering="yes" overwrite="yes" />
<copy file="utils/RUN_PutExportTemplate.bat"
tofile="utils/RUN_PutExport.bat" filtering="yes" overwrite="yes" />
<copy file="utils/RUN_WinEnvTemplate.bat" <copy file="utils/RUN_WinEnvTemplate.bat"
tofile="utils/RUN_WinEnv.bat" filtering="yes" overwrite="yes" /> tofile="utils/RUN_WinEnv.bat" filtering="yes" overwrite="yes" />
@ -86,10 +82,6 @@
<copy file="utils/myEnvironmentTemplate.sh" <copy file="utils/myEnvironmentTemplate.sh"
tofile="utils/myEnvironment.sh" filtering="yes" overwrite="yes" /> tofile="utils/myEnvironment.sh" filtering="yes" overwrite="yes" />
<copy file="utils/RUN_GetAdempiereTemplate.sh"
tofile="utils/RUN_GetAdempiere.sh" filtering="yes" overwrite="yes" />
<copy file="utils/RUN_PutExportTemplate.sh"
tofile="utils/RUN_PutExport.sh" filtering="yes" overwrite="yes" />
<copy file="utils/RUN_UnixEnvTemplate.sh" <copy file="utils/RUN_UnixEnvTemplate.sh"
tofile="utils/RUN_UnixEnv.sh" filtering="yes" overwrite="yes" /> tofile="utils/RUN_UnixEnv.sh" filtering="yes" overwrite="yes" />

View File

@ -18,7 +18,7 @@ goto START
:START :START
@REM Setup idempiere.properties and idempiereEnv.properties @REM Setup idempiere.properties and idempiereEnv.properties
@"%JAVA%" -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar -clean -noRegistryCache -application org.adempiere.install.console-application @"%JAVA%" -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.*.jar -application org.adempiere.install.console-application
@Echo ErrorLevel = %ERRORLEVEL% @Echo ErrorLevel = %ERRORLEVEL%
@IF NOT ERRORLEVEL = 1 GOTO NEXT @IF NOT ERRORLEVEL = 1 GOTO NEXT
@ -30,7 +30,7 @@ goto START
:NEXT :NEXT
@REM setup tomcat @REM setup tomcat
@"%JAVA%" -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar -clean -noRegistryCache -application org.eclipse.ant.core.antRunner -buildfile build.xml @"%JAVA%" -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.*.jar -application org.eclipse.ant.core.antRunner -buildfile build.xml
@Echo . @Echo .
@Echo For problems, check log file in base directory @Echo For problems, check log file in base directory

View File

@ -16,10 +16,10 @@ fi
# Setup idempiere.properties and idempiereEnv.properties # Setup idempiere.properties and idempiereEnv.properties
$JAVA -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar -application org.adempiere.install.console-application $JAVA -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.*.jar -application org.adempiere.install.console-application
# Setup Tomcat # Setup Tomcat
$JAVA -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar -application org.eclipse.ant.core.antRunner -buildfile build.xml $JAVA -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.*.jar -application org.eclipse.ant.core.antRunner -buildfile build.xml
echo =================================== echo ===================================
echo Make .sh executable & set Env echo Make .sh executable & set Env

View File

@ -17,4 +17,4 @@ goto START
@Echo Starting iDempiere Server ... @Echo Starting iDempiere Server ...
@Echo ======================================= @Echo =======================================
@"%JAVA%" -Dosgi.compatibility.bootdelegation=true -Dosgi.noShutdown=true -Dosgi.framework.activeThreadType=normal -XX:MaxPermSize=192m -jar plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar -console -application org.adempiere.server.application @"%JAVA%" -Dosgi.compatibility.bootdelegation=true -Dosgi.noShutdown=true -Dosgi.framework.activeThreadType=normal -XX:MaxPermSize=192m -jar plugins/org.eclipse.equinox.launcher_1.*.jar -console 12612 -application org.adempiere.server.application

View File

@ -13,4 +13,4 @@ echo ===================================
echo Starting iDempiere Server echo Starting iDempiere Server
echo =================================== echo ===================================
$JAVA -Dosgi.compatibility.bootdelegation=true -Dosgi.noShutdown=true -Dosgi.framework.activeThreadType=normal -XX:MaxPermSize=192m -jar plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar -console -application org.adempiere.server.application $JAVA -Dosgi.compatibility.bootdelegation=true -Dosgi.noShutdown=true -Dosgi.framework.activeThreadType=normal -XX:MaxPermSize=192m -jar plugins/org.eclipse.equinox.launcher_1.*.jar -console 12612 -application org.adempiere.server.application

View File

@ -7,7 +7,7 @@
</configIni> </configIni>
<launcherArgs> <launcherArgs>
<programArgs>-console --launcher.XXMaxPermSize 192m</programArgs> <programArgs>-console 12612 --launcher.XXMaxPermSize 192m</programArgs>
<vmArgs>-Dosgi.noShutdown=true -Dosgi.framework.activeThreadType=normal -Dosgi.compatibility.bootdelegation=true</vmArgs> <vmArgs>-Dosgi.noShutdown=true -Dosgi.framework.activeThreadType=normal -Dosgi.compatibility.bootdelegation=true</vmArgs>
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac> <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
</launcherArgs> </launcherArgs>

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@ goto START
:START :START
@REM Setup idempiere.properties and idempiereEnv.properties @REM Setup idempiere.properties and idempiereEnv.properties
@"%JAVA%" -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar -application org.adempiere.install.application -consoleLog @"%JAVA%" -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.*.jar -application org.adempiere.install.application -consoleLog
@Echo ErrorLevel = %ERRORLEVEL% @Echo ErrorLevel = %ERRORLEVEL%
@IF NOT ERRORLEVEL = 1 GOTO NEXT @IF NOT ERRORLEVEL = 1 GOTO NEXT
@ -31,7 +31,7 @@ goto START
:NEXT :NEXT
@REM setup tomcat @REM setup tomcat
@Echo ... Setup Tomcat @Echo ... Setup Tomcat
@"%JAVA%" -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar -application org.eclipse.ant.core.antRunner -buildfile build.xml @"%JAVA%" -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.*.jar -application org.eclipse.ant.core.antRunner -buildfile build.xml
@Echo ... @Echo ...
@Echo For problems, check log file in base directory @Echo For problems, check log file in base directory

View File

@ -15,11 +15,11 @@ else
fi fi
#setup idempiere.properties and idempiereEnv.propertiess #setup idempiere.properties and idempiereEnv.propertiess
$JAVA -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar -application org.adempiere.install.application -consoleLog $JAVA -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.*.jar -application org.adempiere.install.application -consoleLog
echo ... Setup Tomcat echo ... Setup Tomcat
#setup tomcat #setup tomcat
$JAVA -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar -application org.eclipse.ant.core.antRunner -buildfile build.xml $JAVA -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=setup -jar plugins/org.eclipse.osgi_3.7.*.jar -application org.eclipse.ant.core.antRunner -buildfile build.xml
echo ... Make .sh executable echo ... Make .sh executable
chmod -R a+x *.sh chmod -R a+x *.sh

View File

@ -1,29 +0,0 @@
#!/bin/sh
# iDempiere Server Start
if [ $IDEMPIERE_HOME ]; then
cd $IDEMPIERE_HOME/utils
fi
. ./myEnvironment.sh Server
## Check Java Home
if [ $JAVA_HOME ]; then
JAVA=$JAVA_HOME/bin/java
else
JAVA=java
echo JAVA_HOME is not set.
echo You may not be able to start Adempiere
echo Set JAVA_HOME to the directory of your local JDK.
fi
# To use your own Encryption class (implementing org.compiere.util.SecureInterface),
# you need to set it here (and in the client start script) - example:
# SECURE=-DADEMPIERE_SECURE=org.compiere.util.Secure
SECURE=
VMARGS="-Dosgi.compatibility.bootdelegation=true -Djava.awt.headless=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -DIDEMPIERE_HOME=$IDEMPIERE_HOME"
# headless option if you don't have X installed on the server
$JAVA -server $VMARGS -jar $IDEMPIERE_HOME/osgi/org.eclipse.osgi_3.6.0.v20100517.jar -install $IDEMPIERE_HOME/osgi -configuration $IDEMPIERE_HOME/osgi/server -clean -console

View File

@ -1,19 +0,0 @@
#!/bin/sh
# ADempiere Server Stop script
if [ $IDEMPIERE_HOME ]; then
cd $IDEMPIERE_HOME/utils
fi
. ./myEnvironment.sh Server
echo Adempiere Server Stop - $IDEMPIERE_HOME \($ADEMPIERE_DB_NAME\)
JBOSS_LIB=$JBOSS_HOME/lib
export JBOSS_LIB
JBOSS_SERVERLIB=$JBOSS_HOME/server/adempiere/lib
export JBOSS_SERVERLIB
JBOSS_CLASSPATH=$IDEMPIERE_HOME/lib/jboss.jar:$JBOSS_LIB/jboss-system.jar:
export JBOSS_CLASSPATH
echo sh $JBOSS_HOME/bin/shutdown.sh --server=jnp://$ADEMPIERE_APPS_SERVER:$ADEMPIERE_JNP_PORT --shutdown
sh $JBOSS_HOME/bin/shutdown.sh --server=jnp://$ADEMPIERE_APPS_SERVER:$ADEMPIERE_JNP_PORT --shutdown

View File

@ -42,7 +42,7 @@ StartService ()
ConsoleMessage "Starting iDempiere ERP: " ConsoleMessage "Starting iDempiere ERP: "
export LOGFILE=$IDEMPIERE_HOME/log/idempiere_`date +%Y%m%d%H%M%S`.log export LOGFILE=$IDEMPIERE_HOME/log/idempiere_`date +%Y%m%d%H%M%S`.log
export LOOKFILE=$IDEMPIERE_HOME/server.log export LOOKFILE=$IDEMPIERE_HOME/server.log
su root -c "cd $EXECDIR/utils;$EXECDIR/utils/RUN_Server2.sh &> $LOGFILE &" su root -c "cd $EXECDIR;$EXECDIR/idempiere-server.sh &> $LOGFILE &"
RETVAL=$? RETVAL=$?
if [ $RETVAL -eq 0 ] ; then if [ $RETVAL -eq 0 ] ; then
# wait for server to be confirmed as started in logfile # wait for server to be confirmed as started in logfile
@ -58,7 +58,7 @@ StartService ()
fi fi
done done
if [ $STATUSTEST -eq 0 ] if [ $STATUSTEST -eq 0 ]
then then
ConsoleMessage "Service hasn't started within the timeout allowed, please review file $LOGFILE to see the status of the service" ConsoleMessage "Service hasn't started within the timeout allowed, please review file $LOGFILE to see the status of the service"
else else
@ -80,36 +80,25 @@ StopService()
return 1 return 1
fi fi
ConsoleMessage "Stopping iDempiere ERP: " ConsoleMessage "Stopping iDempiere ERP: "
export LASTLOG=`ls -t $IDEMPIERE_HOME/log/idempiere_??????????????.log | head -1`
export LOOKFILE=$IDEMPIERE_HOME/log/server.log
su root -c "cd $EXECDIR/utils;$EXECDIR/utils/RUN_Server2Stop.sh &> /dev/null &"
RETVAL=$? RETVAL=$?
if [ $RETVAL -eq 0 ] ; then # try direct kill with signal 15, then signal 9
# wait for server to be confirmed as halted in logfile kill -15 `ps ax | grep -v grep | grep $EXECDIR | sed -e 's/^ *//g' | cut -f 1 -d " "`
STATUSTEST=0 sleep 5
ITERATIONS=0 IDEMPIERESTATUS=$(ps ax | grep -v grep | grep server| grep $EXECDIR|wc -l)
while [ $STATUSTEST -eq 0 ] ; do if [ $IDEMPIERESTATUS -ne 0 ] ; then
sleep 2 ConsoleMessage "Service stopped with kill -15"
tail -n 5 $LOOKFILE | grep 'Shutdown complete' &> /dev/null && STATUSTEST=1
ITERATIONS=`expr $ITERATIONS + 1`
if [ $ITERATIONS -gt $MAXITERATIONS ]
then
break
fi
done
if [ $STATUSTEST -eq 0 ]
then
ConsoleMessage "Service hasn't stopped within the timeout allowed, please review file $LASTLOG to see the status of the service"
else else
ConsoleMessage "idempiere Stopped" echo "Trying direct kill with signal -9"
fi kill -9 `ps ax | grep -v grep | grep $EXECDIR | sed -e 's/^ *//g' | cut -f 1 -d " "`
echo sleep 5
IDEMPIERESTATUS=$(ps ax | grep -v grep | grep server| grep $EXECDIR|wc -l)
if [ $IDEMPIERESTATUS -ne 0 ] ; then
ConsoleMessage "Service stopped with kill -9"
else else
ConsoleMessage "idempiere Failed to Stop" ConsoleMessage "Service hasn't stopped"
echo fi
fi fi
return $RETVAL return $RETVAL
} }

View File

@ -18,24 +18,22 @@
# initialization # initialization
# adjust these variables to your environment # adjust these variables to your environment
EXECDIR=/opt/idempiere/iDempiere IDEMPIERE_HOME=/home/idempiere/idempiere-server
IDEMPIEREUSER=idempiere IDEMPIEREUSER=idempiere
# Instead of using ENVFILE you can set JAVA_HOME, IDEMPIERE_HOME and add JAVA_HOME/bin to PATH # Instead of using ENVFILE you can set JAVA_HOME, IDEMPIERE_HOME and add JAVA_HOME/bin to PATH
# in this case you can comment the source lines for ENVFILE below # in this case you can comment the source lines for ENVFILE below
# detected some problems with Hardy Heron ubuntu using the bash source command # detected some problems with Hardy Heron ubuntu using the bash source command
ENVFILE=/home/idempiere/.bashrc ENVFILE=$IDEMPIERE_HOME/utils/myEnvironment.sh
# STOPMESSAGE="Halting VM" # Message when using java 5
STOPMESSAGE="INFO.*Server\].*Shutdown complete" # Message when using java 6
. /lib/lsb/init-functions . /lib/lsb/init-functions
RETVAL=0 RETVAL=0
IDEMPIERESTATUS= IDEMPIERESTATUS=
MAXITERATIONS=60 # 2 seconds every iteration, max wait 2 minutes) MAXITERATIONS=60
getidempierestatus() { getidempierestatus() {
IDEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep $EXECDIR) IDEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep $IDEMPIERE_HOME)
echo $IDEMPIERESTATUSSTRING | grep -q $EXECDIR echo $IDEMPIERESTATUSSTRING | grep -q $IDEMPIERE_HOME
IDEMPIERESTATUS=$? IDEMPIERESTATUS=$?
} }
@ -46,10 +44,11 @@ start () {
return 1 return 1
fi fi
echo -n "Starting iDempiere ERP: " echo -n "Starting iDempiere ERP: "
cd $IDEMPIERE_HOME/utils
. $ENVFILE . $ENVFILE
export LOGFILE=$IDEMPIERE_HOME/log/idempiere_`date +%Y%m%d%H%M%S`.log export LOGFILE=$IDEMPIERE_HOME/log/idempiere_`date +%Y%m%d%H%M%S`.log
su $IDEMPIEREUSER -c "mkdir -p IDEMPIERE_HOME/log" su $IDEMPIEREUSER -c "mkdir -p IDEMPIERE_HOME/log"
su $IDEMPIEREUSER -c "cd $EXECDIR/utils;$EXECDIR/utils/RUN_Server2.sh &> $LOGFILE &" su $IDEMPIEREUSER -c "cd $IDEMPIERE_HOME;$IDEMPIERE_HOME/idempiere-server.sh &> $LOGFILE &"
RETVAL=$? RETVAL=$?
if [ $RETVAL -eq 0 ] ; then if [ $RETVAL -eq 0 ] ; then
# wait for server to be confirmed as started in logfile # wait for server to be confirmed as started in logfile
@ -57,7 +56,7 @@ start () {
ITERATIONS=0 ITERATIONS=0
while [ $STATUSTEST -eq 0 ] ; do while [ $STATUSTEST -eq 0 ] ; do
sleep 2 sleep 2
tail -n 9 $LOGFILE | grep -q 'INFO.*\[Server\].*Started in' && STATUSTEST=1 tail -n 9 $LOGFILE | grep -q '.*WebUIServlet.*started successfully.*' && STATUSTEST=1
echo -n "." echo -n "."
ITERATIONS=`expr $ITERATIONS + 1` ITERATIONS=`expr $ITERATIONS + 1`
if [ $ITERATIONS -gt $MAXITERATIONS ] if [ $ITERATIONS -gt $MAXITERATIONS ]
@ -76,6 +75,7 @@ start () {
log_failure_msg "Service not started" log_failure_msg "Service not started"
echo echo
fi fi
RETVAL=$?
return $RETVAL return $RETVAL
} }
@ -86,38 +86,18 @@ stop () {
return 1 return 1
fi fi
echo -n "Stopping iDempiere ERP: " echo -n "Stopping iDempiere ERP: "
cd $IDEMPIERE_HOME/utils
. $ENVFILE . $ENVFILE
# export LASTLOG=`ls -t $IDEMPIERE_HOME/log/adempiere_??????????????.log | head -1`
export LASTLOG=$IDEMPIERE_HOME/adempiere/log/server.log
su $IDEMPIEREUSER -c "cd $EXECDIR/utils;$EXECDIR/utils/RUN_Server2Stop.sh &> /dev/null &"
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
# wait for server to be confirmed as halted in logfile
STATUSTEST=0
ITERATIONS=0
while [ $STATUSTEST -eq 0 ] ; do
sleep 2
tail -n 9 $LASTLOG | grep -q "$STOPMESSAGE" && STATUSTEST=1
echo -n "."
ITERATIONS=`expr $ITERATIONS + 1`
if [ $ITERATIONS -gt $MAXITERATIONS ]
then
break
fi
done
if [ $STATUSTEST -eq 0 ]
then
log_warning_msg "Service hasn't stopped within the timeout allowed, please review file $LASTLOG to see the status of the service"
log_warning_msg "Trying direct kill with signal -15" log_warning_msg "Trying direct kill with signal -15"
# idempiere didn't finish - try direct kill with signal 15, then signal 9 # try direct kill with signal 15, then signal 9
kill -15 `ps ax | grep -v grep | grep $EXECDIR | sed -e 's/^ *//g' | cut -f 1 -d " "` kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " "`
sleep 5 sleep 5
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then if [ $IDEMPIERESTATUS -ne 0 ] ; then
log_success_msg "Service stopped with kill -15" log_success_msg "Service stopped with kill -15"
else else
echo "Trying direct kill with signal -9" echo "Trying direct kill with signal -9"
kill -9 `ps ax | grep -v grep | grep $EXECDIR | sed -e 's/^ *//g' | cut -f 1 -d " "` kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " "`
sleep 5 sleep 5
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then if [ $IDEMPIERESTATUS -ne 0 ] ; then
@ -126,14 +106,6 @@ stop () {
log_warning_msg "Service hasn't stopped" log_warning_msg "Service hasn't stopped"
fi fi
fi fi
else
log_success_msg "Service stopped"
fi
echo
else
log_failure_msg "Service not stopped"
echo
fi
return $RETVAL return $RETVAL
} }
@ -150,12 +122,12 @@ condrestart () {
fi fi
} }
rhstatus () { status () {
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -eq 0 ] ; then if [ $IDEMPIERESTATUS -eq 0 ] ; then
echo echo
echo "iDempiere is running:" echo "iDempiere is running:"
ps ax | grep -v grep | grep $EXECDIR | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' ps ax | grep -v grep | grep $IDEMPIERE_HOME | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/'
echo echo
else else
echo "iDempiere is stopped" echo "iDempiere is stopped"
@ -179,7 +151,7 @@ case "$1" in
condrestart condrestart
;; ;;
status) status)
rhstatus status
;; ;;
*) *)
echo $"Usage: $0 {start|stop|reload|restart|condrestart|status}" echo $"Usage: $0 {start|stop|reload|restart|condrestart|status}"

View File

@ -17,11 +17,9 @@
# initialization # initialization
# adjust these variables to your environment # adjust these variables to your environment
EXECDIR=/home/idempiere/iDempiere IDEMPIERE_HOME=/home/idempiere/idempiere-server
ENVFILE=/home/idempiere/.bash_profile ENVFILE=$IDEMPIERE_HOME/utils/myEnvironment.sh
IDEMPIEREUSER=idempiere IDEMPIEREUSER=idempiere
# STOPMESSAGE="Halting VM" # Message when using java 5
STOPMESSAGE="INFO.*Server\].*Shutdown complete" # Message when using java 6
. /etc/rc.d/init.d/functions . /etc/rc.d/init.d/functions
@ -30,22 +28,22 @@ IDEMPIERESTATUS=
MAXITERATIONS=60 # 2 seconds every iteration, max wait 2 minutes) MAXITERATIONS=60 # 2 seconds every iteration, max wait 2 minutes)
getidempierestatus() { getidempierestatus() {
IDEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep $EXECDIR) IDEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep $IDEMPIERE_HOME)
echo $IDEMPIERESTATUSSTRING | grep -q $EXECDIR echo $IDEMPIERESTATUSSTRING | grep -q $IDEMPIERE_HOME
IDEMPIERESTATUS=$? IDEMPIERESTATUS=$?
} }
start () { start () {
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -eq 0 ] ; then if [ $IDEMPIERESTATUS -eq 0 ] ; then
echo "idempiere is already running" echo "iDempiere is already running"
return 1 return 1
fi fi
echo -n "Starting ADempiere ERP: " echo -n "Starting ADempiere ERP: "
source $ENVFILE source $ENVFILE
export LOGFILE=$IDEMPIERE_HOME/log/idempiere_`date +%Y%m%d%H%M%S`.log export LOGFILE=$IDEMPIERE_HOME/log/idempiere_`date +%Y%m%d%H%M%S`.log
su $IDEMPIEREUSER -c "mkdir -p $IDEMPIERE_HOME/log" su $IDEMPIEREUSER -c "mkdir -p $IDEMPIERE_HOME/log"
su $IDEMPIEREUSER -c "cd $EXECDIR/utils;$EXECDIR/utils/RUN_Server2.sh &> $LOGFILE &" su $IDEMPIEREUSER -c "cd $IDEMPIERE_HOME;$IDEMPIERE_HOME/idempiere-server.sh &> $LOGFILE &"
RETVAL=$? RETVAL=$?
if [ $RETVAL -eq 0 ] ; then if [ $RETVAL -eq 0 ] ; then
# wait for server to be confirmed as started in logfile # wait for server to be confirmed as started in logfile
@ -53,7 +51,7 @@ start () {
ITERATIONS=0 ITERATIONS=0
while [ $STATUSTEST -eq 0 ] ; do while [ $STATUSTEST -eq 0 ] ; do
sleep 2 sleep 2
tail -n 9 $LOGFILE | grep -q 'INFO.*\[Server\].*Started in' && STATUSTEST=1 tail -n 9 $LOGFILE | grep -q '.*WebUIServlet.*started successfully.*' && STATUSTEST=1
echo -n "." echo -n "."
ITERATIONS=`expr $ITERATIONS + 1` ITERATIONS=`expr $ITERATIONS + 1`
if [ $ITERATIONS -gt $MAXITERATIONS ] if [ $ITERATIONS -gt $MAXITERATIONS ]
@ -82,39 +80,18 @@ stop () {
echo "idempiere is already stopped" echo "idempiere is already stopped"
return 1 return 1
fi fi
echo -n "Stopping ADempiere ERP: " echo -n "Stopping iDempiere ERP: "
source $ENVFILE source $ENVFILE
# export LASTLOG=`ls -t $IDEMPIERE_HOME/log/idempiere_??????????????.log | head -1`
export LASTLOG=$IDEMPIERE_HOME/log/server.log
su $IDEMPIEREUSER -c "cd $EXECDIR/utils;$EXECDIR/utils/RUN_Server2Stop.sh &> /dev/null &"
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
# wait for server to be confirmed as halted in logfile
STATUSTEST=0
ITERATIONS=0
while [ $STATUSTEST -eq 0 ] ; do
sleep 2
tail -n 9 $LASTLOG | grep -q "$STOPMESSAGE" && STATUSTEST=1
echo -n "."
ITERATIONS=`expr $ITERATIONS + 1`
if [ $ITERATIONS -gt $MAXITERATIONS ]
then
break
fi
done
if [ $STATUSTEST -eq 0 ]
then
echo "Service hasn't stopped within the timeout allowed, please review file $LASTLOG to see the status of the service"
echo "Trying direct kill with signal -15" echo "Trying direct kill with signal -15"
# Adempiere didn't finish - try direct kill with signal 15, then signal 9 # Adempiere didn't finish - try direct kill with signal 15, then signal 9
kill -15 `ps ax | grep -v grep | grep $EXECDIR | sed -e 's/^ *//g' | cut -f 1 -d " "` kill -15 `ps ax | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " "`
sleep 5 sleep 5
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo_success echo_success
else else
echo "Trying direct kill with signal -9" echo "Trying direct kill with signal -9"
kill -9 `ps ax | grep -v grep | grep $EXECDIR | sed -e 's/^ *//g' | cut -f 1 -d " "` kill -9 `ps ax | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " "`
sleep 5 sleep 5
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then if [ $IDEMPIERESTATUS -ne 0 ] ; then
@ -123,14 +100,7 @@ stop () {
echo_warning echo_warning
fi fi
fi fi
else RETVAL=$?
echo_success
fi
echo
else
echo_failure
echo
fi
return $RETVAL return $RETVAL
} }
@ -147,12 +117,12 @@ condrestart () {
fi fi
} }
rhstatus () { status () {
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -eq 0 ] ; then if [ $IDEMPIERESTATUS -eq 0 ] ; then
echo echo
echo "idempiere is running:" echo "idempiere is running:"
ps ax | grep -v grep | grep $EXECDIR | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' ps ax | grep -v grep | grep $IDEMPIERE_HOME | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/'
echo echo
else else
echo "idempiere is stopped" echo "idempiere is stopped"
@ -176,7 +146,7 @@ case "$1" in
condrestart condrestart
;; ;;
status) status)
rhstatus status
;; ;;
*) *)
echo $"Usage: $0 {start|stop|reload|restart|condrestart|status}" echo $"Usage: $0 {start|stop|reload|restart|condrestart|status}"

View File

@ -1,25 +0,0 @@
@if (%IDEMPIERE_HOME%) == () (CALL myEnvironment.bat Server) else (CALL %IDEMPIERE_HOME%\utils\myEnvironment.bat Server)
@Title Adempiere Server Start - %IDEMPIERE_HOME% (%ADEMPIERE_APPS_TYPE%)
@Rem $Id: RUN_Server2.bat,v 1.24 2005/10/26 00:38:18 jjanke Exp $
:CHECK_JAVA:
@if not "%JAVA_HOME%" == "" goto JAVA_HOME_OK
@Set JAVA=java
@Echo JAVA_HOME is not set.
@Echo You may not be able to start Adempiere
@Echo Set JAVA_HOME to the directory of your local JDK.
@Echo You could set it via WinEnv.js e.g.:
@Echo cscript WinEnv.js C:\Adempiere C:\j2sdk1.4.2_06
@goto CHECK_ADEMPIERE
:JAVA_HOME_OK
@Set JAVA=%JAVA_HOME%\bin\java
@Rem To use your own Encryption class (implementing org.compiere.util.SecureInterface),
@Rem you need to set it here (and in the client start script) - example:
@Rem SET SECURE=-DADEMPIERE_SECURE=org.compiere.util.Secure
@SET SECURE=
VMARGS="-Dosgi.compatibility.bootdelegation=true -Djava.awt.headless=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -DIDEMPIERE_HOME=%IDEMPIERE_HOME%"
# headless option if you don't have X installed on the server
@"%JAVA%" -server %VMARGS% -jar %IDEMPIERE_HOME%/osgi/org.eclipse.osgi_3.6.0.v20100517.jar -install %IDEMPIERE_HOME%/osgi -configuration %IDEMPIERE_HOME%/osgi/server -clean -console

View File

@ -1,28 +0,0 @@
@if (%IDEMPIERE_HOME%) == () (CALL myEnvironment.bat Server) else (CALL %IDEMPIERE_HOME%\utils\myEnvironment.bat Server)
@Title Adempiere Server Stop - %IDEMPIERE_HOME%
@Rem $Id: RUN_Server2Stop.bat,v 1.12 2005/09/06 02:46:16 jjanke Exp $
@IF '%ADEMPIERE_APPS_TYPE%' == 'jboss' GOTO JBOSS
@GOTO UNSUPPORTED
:JBOSS
@Set NOPAUSE=Yes
@Set JBOSS_LIB=%JBOSS_HOME%\lib
@Set JBOSS_SERVERLIB=%JBOSS_HOME%\server\adempiere\lib
@Set JBOSS_CLASSPATH=%IDEMPIERE_HOME%\lib\jboss.jar;%JBOSS_LIB%\jboss-system.jar
@CD %JBOSS_HOME%\bin
Call shutdown --server=jnp://%ADEMPIERE_APPS_SERVER%:%ADEMPIERE_JNP_PORT% --shutdown
@Echo Done Stopping Adempiere Apps Server %IDEMPIERE_HOME% (%ADEMPIERE_DB_NAME%)
@GOTO END
:UNSUPPORTED
@Echo Apps Server stop of %ADEMPIERE_APPS_TYPE% not supported
:END
@Rem Sleep 30
@CHOICE /C YN /T 30 /D N > NUL
@Exit

View File

@ -1,9 +0,0 @@
@if (%IDEMPIERE_HOME%) == () (CALL myEnvironment.bat Server) else (CALL %IDEMPIERE_HOME%\utils\myEnvironment.bat Server)
@Title Start Adempiere - %IDEMPIERE_HOME% (%ADEMPIERE_DB_NAME%)
@Rem $Id: RUN_Start.bat,v 1.11 2005/01/22 21:59:15 jjanke Exp $
@Echo Starting Database
@CALL %ADEMPIERE_DB_PATH%\Start.bat
@START %IDEMPIERE_HOME%\utils\RUN_Server2.bat

View File

@ -1,9 +0,0 @@
@if (%IDEMPIERE_HOME%) == () (CALL myEnvironment.bat Server) else (CALL %IDEMPIERE_HOME%\utils\myEnvironment.bat Server)
@Title Stop Adempiere - %IDEMPIERE_HOME% (%ADEMPIERE_DB_NAME%)
@Rem $Id: RUN_Stop.bat,v 1.11 2005/01/22 21:59:15 jjanke Exp $
@CALL %IDEMPIERE_HOME%\utils\RUN_Server2Stop.bat
@CALL %ADEMPIERE_DB_PATH%\Stop.bat

View File

@ -4,5 +4,5 @@ REM Adempiere_Service_Uninstall.bat - globalqss - based on http://javaservice.ob
if (%IDEMPIERE_HOME%) == () (CALL myEnvironment.bat Server) else (CALL %IDEMPIERE_HOME%\utils\myEnvironment.bat Server) if (%IDEMPIERE_HOME%) == () (CALL myEnvironment.bat Server) else (CALL %IDEMPIERE_HOME%\utils\myEnvironment.bat Server)
NET STOP Adempiere NET STOP idempiere
%IDEMPIERE_HOME%\utils\windows\AdempiereService.exe -uninstall Adempiere %IDEMPIERE_HOME%\utils\windows\idempiereService.exe -uninstall idempiere