Talk:Running iDempiere from Installers

From iDempiere en

Yogan Naidoo - nTier Software

I had to do the following to get the service working on Suse Enterprise Server 15.

Changed the stop() as follows: ....the important changes were:

 # Retrieve the process IDs (pids) instead of process group IDs (pgids)
 PIDS=$(ps ax o pid,command | grep java | grep "${IDEMPIERE_HOME}" | grep -v grep | awk '{print $1}')
 ...note the grep java as well...otherwise it kills the service as well.
 stop() {
   getidempierestatus
   if [ $IDEMPIERESTATUS -ne 0 ] ; then
       echo "iDempiere is already stopped"
       rc_failed 0
       return
   fi
   echo -n "Stopping iDempiere ERP: "
   cd $IDEMPIERE_HOME/utils || exit
   export ID_ENV=Server
   . $ENVFILE
   # try shutdown from OSGi console, then direct kill with signal 15, then signal 9
   log_warning_msg "Trying shutdown from OSGi console"
   ( echo exit; echo y; sleep 5 ) | telnet localhost ${TELNET_PORT} > /dev/null 2>&1
   
   # Retrieve the process IDs (pids) instead of process group IDs (pgids)
   PIDS=$(ps ax o pid,command | grep java | grep "${IDEMPIERE_HOME}" | grep -v grep | awk '{print $1}')
 
   if [ -z "$PIDS" ]; then
   	echo "iDempiere process is not running"
   else
   	# Loop through each pid and send signal -15 (SIGTERM) to terminate the process
   	for PID in $PIDS; do
           echo "Trying to stop iDempiere process with pid: $PID.Trying with signal -15"
           kill -15 "$PID"
   	done
 
   	# Wait for a moment to allow the processes to terminate gracefully
   	sleep 5
 
   	# Check if any processes are still running
   	for PID in $PIDS; do
           if ps -p "$PID" > /dev/null; then
           	echo "Failed to stop iDempiere process with pid: $PID. Trying with signal -9"
           	kill -9 "$PID"
           else
           	echo "Successfully stopped iDempiere process with pid: $PID"
           fi
       done
   fi
   rc_status -v
 }

and then I struggled with the service file as well. This eventually worked for me:

 [Unit]
 Description=iDempiere Service
 After=network.target
 
 [Service]
 ExecStart=/opt/idempiere-server/utils/unix/idempiere_Suse.sh start
 RemainAfterExit=true
 ExecStop=/opt/idempiere-server/utils/unix/idempiere_Suse.sh stop
 ExecReload=/opt/idempiere-server/utils/unix/idempiere_Suse.sh restart
 Type=oneshot
 
 [Install]
 WantedBy=multi-user.target
Cookies help us deliver our services. By using our services, you agree to our use of cookies.