Skip to content

Commit 46ca413

Browse files
committed
Use wasservice.sh to create WebSphere Service
Signed-off-by: Jianguo Ma <[email protected]>
1 parent f376a68 commit 46ca413

File tree

2 files changed

+14
-27
lines changed

2 files changed

+14
-27
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<groupId>com.ibm.websphere.azure</groupId>
2222
<artifactId>azure.websphere-traditional.cluster</artifactId>
23-
<version>1.3.18</version>
23+
<version>1.3.19</version>
2424

2525
<parent>
2626
<groupId>com.microsoft.azure.iaas</groupId>

src/main/scripts/install.sh

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -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

9279
create_cluster() {
@@ -282,7 +269,7 @@ source /datadrive/virtualimage.properties
282269
if [ "$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
293280
else
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
297284
fi

0 commit comments

Comments
 (0)