About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Question & Answer
Question
How to configure IBM HTTP Server to autostart in Linux ?
Answer
On Demand Consulting
Author: Patrick Nogay
If you are on a modern version of Linux that supports systemd then this article has examples for configuring a service to autostart IBM HTTP Server when Linux is rebooted.
1) First create a script that will start or stop IBM HTTP Server (IHS) using the apachectl command.
In this example IHS is installed in /opt/app/IBM/IHS855, and the startscript ihs.sh will be placed in directory /opt/app/IBM/startscripts
Here is the content of /opt/app/IBM/startscripts/ihs.sh:
#!/bin/sh
#
# Starts the IBM HTTP Server
# This should be copied into /opt/app/IBM/startscripts/ibmIHS.sh
#
# description: Runs IHS Server
# Source function library.
#======================================================================
#======================================================================
start() {
echo "$0: starting IBM HTTP Server"
/opt/app/IBM/IHS855/bin/apachectl -k start -f /opt/app/IBM/IHS855/conf/httpd.conf
echo "IHS Startup completed"
}
#==============================================================================
stop() {
echo "$0: stopping IBM HTTP Server"
/opt/app/IBM/IHS855/bin/apachectl -k stop -f /opt/app/IBM/IHS855/conf/httpd.conf
echo "IHS Shutdown completed"
}
case $1 in
'start')
start
;;
'stop')
stop
;;
'restart')
stop
start
;;
*)
echo "usage: $0 {start|stop|restart}"
;;
esac
##### Do not include this in the ihs.sh file #####
2) Create the ibmIHS.service file and copy it into /usr/lib/systemd/system
The ibmIHS.service will be registered with Linux systemd to execute during shutdown and startup.
The following contents should be placed in /usr/lib/systemd/system/ibmIHS.service:
####################################################################
#Create Startup Service using systemd
#Put this file in /usr/lib/systemd/system/ibmIHS.service
####################################################################
[Unit]
Description=IBM HTTP Server
[Service]
Type=oneshot
ExecStart=/opt/app/IBM/startscripts/ihs.sh start
ExecStop=/opt/app/IBM/startscripts/ihs.sh stop
User=root
RemainAfterExit=yes
[Install]
WantedBy=default.target
#### Do NOT include this line in the ibmIHS.service file ####
3) Register the ibmIHS.service with Linux
Run the following commands to register the ibmIHS.service with Linux:
cd /usr/lib/systemd/system
systemctl enable ibmIHS
?
[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSQTW3","label":"IBM On Demand Consulting for Hybrid Cloud"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"","label":""}}]
Was this topic helpful?
Document Information
More support for:
IBM On Demand Consulting for Hybrid Cloud
Software version:
All Versions
Document number:
771827
Modified date:
16 March 2019
UID
ibm10771827
Manage My Notification Subscriptions