Difference between revisions of "Talk:Running iDempiere from Installers"

From iDempiere en
 
(2 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
....the important changes were:
 
....the important changes were:
  
# Retrieve the process IDs (pids) instead of process group IDs (pgids)
+
  # 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}')
 
   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.
 
   ...note the grep java as well...otherwise it kills the service as well.
Line 15: Line 15:
 
         echo "iDempiere is already stopped"
 
         echo "iDempiere is already stopped"
 
         rc_failed 0
 
         rc_failed 0
return
+
        return
 
     fi
 
     fi
 
     echo -n "Stopping iDempiere ERP: "
 
     echo -n "Stopping iDempiere ERP: "
Line 36: Line 36:
 
             kill -15 "$PID"
 
             kill -15 "$PID"
 
     done
 
     done
 
+
 
 
     # Wait for a moment to allow the processes to terminate gracefully
 
     # Wait for a moment to allow the processes to terminate gracefully
 
     sleep 5
 
     sleep 5
 
+
 
 
     # Check if any processes are still running
 
     # Check if any processes are still running
 
     for PID in $PIDS; do
 
     for PID in $PIDS; do
Line 48: Line 48:
 
             echo "Successfully stopped iDempiere process with pid: $PID"
 
             echo "Successfully stopped iDempiere process with pid: $PID"
 
             fi
 
             fi
done
+
        done
 
     fi
 
     fi
 
     rc_status -v
 
     rc_status -v

Latest revision as of 10:19, 7 July 2023

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.