Salesforce

Can a Linux systemd service status used to start/stop the adminserver be kept in sync with the proadsv start/stop commands?

« Go Back

Information

 
TitleCan a Linux systemd service status used to start/stop the adminserver be kept in sync with the proadsv start/stop commands?
URL Namecan-a-linux-systemd-service-status-used-to-start-stop-the-adminserver-be-kept-in-sync-with-the-proadsv-start-stop-commands
Article Number000164112
EnvironmentProduct: OpenEdge
Version: All supported versions
OS: CentOS/RedHat Linux 7.x 8.x
Question/Problem Description
Can a Linux systemd service status used to start/stop the adminserver be kept in sync with the proadsv start/stop commands?
Steps to Reproduce
Clarifying Information
A systemd service is used to manage the OpenEdge AdminServer.
The systemd service works fine if the OpenEdge AdminServer is fully managed by the systemd service.
When the systemd service is used in combination with the proadsv commands (/usr/dlc/bin/proadsv -start, /usr/dlc/bin/proadsv -stop), the proadsv commands do not update the status of the systemd openedge service with the consequence that the systemd openege service no longer knows when the OpenEdge AdminServer is running or not.
Error Message
Defect Number
Enhancement Number
Cause
This is expected behavior, the proadsv is not aware of the custom systemd script and therefore does not update the systemd service status.
Resolution
An enhancement has been requested under the following link:

https://community.progress.com/community_groups/products_enhancements/i/openedge_installation__deployment/systemd_service_to_manage_the_adminserver


This enhancement has not been implemented in the product.  As an alternative use the workaround below.
Workaround
Notes
As a workaround it is possible to rename the original proadsv script file:

$DLC/bin/proadsv

to 

$DLC/bin/PSCproadsv

and use a custom $DLC/bin/proadsv containing lines like:
 
#!/bin/bash

if [ "$1" = "-start" ]
   then echo 'starting adminserver'
   if [ "$1" != "" ];
      then echo "ARG1="$1 > /usr/117/wrk/arguments.txt
   fi
   if [ "$2" != "" ];
      then echo "ARG2="$2 >> /usr/117/wrk/arguments.txt
   fi
   if [ "$3" != "" ];
      then echo "ARG3="$3 >> /usr/117/wrk/arguments.txt
   fi
   if [ "$4" != "" ];
      then echo "ARG4="$4 >> /usr/117/wrk/arguments.txt
   fi   
   if [ "$5" != "" ];
      then echo "ARG5="$5 >> /usr/117/wrk/arguments.txt
   fi
   if [ "$6" != "" ];
      then echo "ARG6="$6 >> /usr/117/wrk/arguments.txt
   fi
   if [ "$7" != "" ];
      then echo "ARG7="$7 >> /usr/117/wrk/arguments.txt
   fi
   if [ "$8" != "" ];
      then echo "ARG8="$8 >> /usr/117/wrk/arguments.txt
   fi   
   /usr/bin/systemctl start openedge

elif
   [ "$1" = "-stop" ];
   then echo 'stopping adminserver'
   if [ "$1" != "" ];
      then echo "ARG1="$1 > /usr/117/wrk/arguments.txt
   fi
   if [ "$2" != "" ];
      then echo "ARG2="$2 >> /usr/117/wrk/arguments.txt
   fi
   if [ "$3" != "" ];
      then echo "ARG3="$3 >> /usr/117/wrk/arguments.txt
   fi
   if [ "$4" != "" ];
      then echo "ARG4="$4 >> /usr/117/wrk/arguments.txt
   fi   
   if [ "$5" != "" ];
      then echo "ARG5="$5 >> /usr/117/wrk/arguments.txt
   fi
   if [ "$6" != "" ];
      then echo "ARG6="$6 >> /usr/117/wrk/arguments.txt
   fi
   if [ "$7" != "" ];
      then echo "ARG7="$7 >> /usr/117/wrk/arguments.txt
   fi
   if [ "$8" != "" ];
      then echo "ARG8="$8 >> /usr/117/wrk/arguments.txt
   fi   
   /usr/bin/systemctl stop openedge

elif   
   [ "$1" = "-query" ];
   then echo 'querying adminserver'
   /usr/117/dlc/bin/PSCproadsv -query "$@"

elif
   [ "$1" = "-help" ];
   then echo 'adminserver help'      
   /usr/117/dlc/bin/PSCproadsv -help

elif
   [ "$1" = "-status" ];
   then echo '--> status of the openedge systemctl service'
   /usr/bin/systemctl status openedge
   
elif
   [ "$1" = "" ];
   then echo 'no arguments were given to this custom proadsv command'
   #/usr/dlc/bin/PSCproadsv
fi

which redirect the 'proadsv -start' and 'proadsv -stop' commands to the '/usr/bin/systemctl start openedge' and '/usr/bin/systemctl stop openedge' commands.
The '/usr/bin/systemctl start openedge' and '/usr/bin/systemctl stop openedge' commands are then executed against the unmodified $DLC/bin/PSCproadsv script.

The content of the file /etc/systemd/system/openedge.service would then be like:
 
[Unit]
Description=Start/Stop Openedge adminserver
After=syslog.target network.target

[Service]
Type=forking
User=root
Group=root
Environment=TERM=xterm
EnvironmentFile=/usr/117/wrk/arguments.txt
#WorkingDirectory=/tmp
KillMode=none
SendSIGKILL=no
RemainAfterExit=yes

ExecStart=/usr/117/dlc/bin/PSCproadsv $ARG1 $ARG2 $ARG3 $ARG4 $ARG5 $ARG6 $ARG7 $ARG8
ExecStop=/usr/117/dlc/bin/PSCproadsv $ARG1 $ARG2 $ARG3 $ARG4 $ARG5 $ARG6 $ARG7 $ARG8

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=30

[Install]
WantedBy=multi-user.target

Since that /etc/systemd/system/openedge.service requires arguments from a file like /usr/117/wrk/arguments.txt that would not be generated or possibly contain wrong information this openedge systemd service cannot be started or stopped automatically at boot or shutdown of the Linux machine.    
Therefore instead of directly starting this /etc/systemd/system/openedge.service systemd service another systemd service called for example /etc/systemd/system/oeMachineStartStop.service containing lines like this will need to be created:
 
[Unit]
Description=Start/Stop the openedge service at Linux machine startup or shutdown
After=syslog.target network.target

[Service]
Type=forking
User=root
Group=root
Environment=TERM=xterm
KillMode=none
SendSIGKILL=no
RemainAfterExit=yes

ExecStart=/usr/117/dlc/bin/proadsv -start
ExecStop=/usr/117/dlc/bin/proadsv -stop

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=30

[Install]
WantedBy=multi-user.target

and then make that service start/stop with the Linux machine using (as root) the command:

systemctl enable oeMachineStartStop

if an existing /etc/systemd/system/openedge.service systemd service that automatically start with the  Linux machine already exist then make sure that systemd service do not start directly by itself anymore using the command:

systemctl disable openedge

Also make sure the file /usr/wrk/arguments.txt used to pass the arguments to the systemd openedge service have the correct file permissions by doing a:

chmod 666 /usr/wrk/arguments.txt

otherwise (not all) Linux users will be able to pass arguments using the custom proadsv command. (and therefore fail to execute the custom proadsv commands)
   
Example files $DLC/bin/proadsv, /etc/systemd/system/openedge.service and /etc/systemd/system/oeMachineStartStop.service are attached to this supportLink case.
Please note that in those files the $DLC directory used is /usr/117/dlc and the $WRKDIR directory used is /usr/117/dlc make sure to edit those files to use the correct location for those directories.
Also make sure to do a

mv $DLC/bin/proadsv $DLC/bin/PSCproadsv

so that the /etc/systemd/system/openedge.service file can find the needed original unmodified proadsv script called PSCproadsv
and give execute permissions to the new files created, for example with the commands:

chmod 777 $DLC/bin/proadsv
chmod 777 /etc/systemd/system/openedge.service
chmod 777 /etc/systemd/system/oeMachineStartStop.service
 
Keyword Phrase
Last Modified Date12/5/2019 9:13 AM

Powered by