@@ -62,31 +62,18 @@ add_admin_credentials_to_soap_client_props() {
6262 ${WAS_ND_INSTALL_DIRECTORY} /profiles/${profileName} /bin/PropFilePasswordEncoder.sh " $soapClientProps " com.ibm.SOAP.loginPassword
6363}
6464
65- create_systemd_service () {
66- srvName=$1
67- srvDescription=$2
68- profileName=$3
69- serverName=$4
70-
71- # Add systemd unit file
72- cat << EOF > /etc/systemd/system/${srvName} .service
73- [Unit]
74- Description=${srvDescription}
75- RequiresMountsFor=/datadrive
76- [Service]
77- Type=forking
78- ExecStart=/bin/sh -c "${WAS_ND_INSTALL_DIRECTORY} /profiles/${profileName} /bin/startServer.sh ${serverName} "
79- ExecStop=/bin/sh -c "${WAS_ND_INSTALL_DIRECTORY} /profiles/${profileName} /bin/stopServer.sh ${serverName} "
80- PIDFile=${WAS_ND_INSTALL_DIRECTORY} /profiles/${profileName} /logs/${serverName} /${serverName} .pid
81- SuccessExitStatus=143 0
82- TimeoutStartSec=900
83- [Install]
84- WantedBy=default.target
85- EOF
65+ create_was_service () {
66+ serverName=$1
67+ serviceName=${serverName}
68+ profileName=$2
69+ profilePath=${WAS_ND_INSTALL_DIRECTORY} /profiles/${profileName}
70+
71+ # Configure SELinux so systemctl has access on server start/stop script files
72+ semanage fcontext -a -t bin_t " ${profilePath} /bin(/.*)?"
73+ restorecon -r -v ${profilePath} /bin
8674
87- # Enable service
88- systemctl daemon-reload
89- systemctl enable " $srvName "
75+ # Add service
76+ ${profilePath} /bin/wasservice.sh -add ${serviceName} -serverName ${serverName} -profilePath ${profilePath}
9077}
9178
9279create_cluster () {
@@ -282,7 +269,7 @@ source /datadrive/virtualimage.properties
282269if [ " $dmgr " = True ]; then
283270 create_dmgr_profile Dmgr001 $( hostname) Dmgr001Node Dmgr001NodeCell " $adminUserName " " $adminPassword "
284271 add_admin_credentials_to_soap_client_props Dmgr001 " $adminUserName " " $adminPassword "
285- create_systemd_service was_dmgr " IBM WebSphere Application Server ND Deployment Manager " Dmgr001 dmgr
272+ create_was_service dmgr Dmgr001
286273 ${WAS_ND_INSTALL_DIRECTORY} /profiles/Dmgr001/bin/startServer.sh dmgr
287274 create_cluster Dmgr001 Dmgr001Node Dmgr001NodeCell MyCluster $members $dynamic
288275
@@ -293,5 +280,5 @@ if [ "$dmgr" = True ]; then
293280else
294281 create_custom_profile Custom $( hostname) $( hostname) Node01 $dmgrHostName 8879 " $adminUserName " " $adminPassword "
295282 add_admin_credentials_to_soap_client_props Custom " $adminUserName " " $adminPassword "
296- create_systemd_service was_nodeagent " IBM WebSphere Application Server ND Node Agent " Custom nodeagent
283+ create_was_service nodeagent Custom
297284fi
0 commit comments