Start WebSphere Application Server
WebSphere Application Server provides the
startServer.sh
shell script to simplify the application server startup process. This script takes one argument, which is the name of the application server that you want to start. On systems where you have newly installed the WebSphere Application Server, the name of the default server is server1
. To start the application server, use the
su
or sudo -s
commands (depending on the UNIX system or Linux distribution you are using), to become a privileged user on the system where you installed the application server. Enter the root password or your password (respectively) when prompted to do so. Next, enter the following command to start WebSphere Application Server:
/opt/IBM/WebSphere/AppServer/bin/startServer.sh server1 |
As the application server starts, you will see output similar to that displayed in the output window shown in Figure 11. The command prompt redisplays when the server startup process completes and the application server is ready for use.
System startup and shutdown integration
After installing a Web server on your system, you typically want it to start automatically any time you restart your system. When installing WebSphere Application Server on platforms such as Microsoft Windows, the installation process enables you to define the server and administration server as Windows services that start automatically when your system starts. Unfortunately, the UNIX and Linux installers don't provide any equivalent integration into the startup processes for those systems. Therefore, you must manually integrate WebSphere Application Server into the startup process on UNIX and Linux systems.
All UNIX and Linux systems define the tasks that should be performed during the startup and shutdown processes via a series of shell scripts (commonly referred to as init scripts) that are executed as the system starts. On most UNIX and Linux systems, these scripts are organized in the way specified by the SysVInit (that is, System V Init, which refers to an old version of UNIX) system startup mechanism (see Resources for more information). In this mechanism, the primary startup scripts for the system all reside in /etc/init.d (which may be a symbolic link to the /etc/rc.d/init.d directory on some systems). The specific scripts that are executed as the system boots into a specific numeric level of operation (known as a runlevel) are symbolic links from directories with names of the form /etc/rcrunlevel.d to the scripts in the /etc/init.d directory. Ubuntu Linux systems use a different startup mechanism that is configured to be compatible with the SysVInit process, and is explained in a subsequent section.
Create a SysVInit script
To create a SysVInit script for WebSphere Application Server, you can do one of the following:
- Download the sample SysVInit script that is provided with this tutorial.
- Copy an existing
init
script and modify it to execute the processes associated with your WebSphere Application Server installation.
Listing 1. Sample SysVInit script
#!/bin/bash # # Simple startup script for IBM WebSphere Application Server # # chkconfig: - 85 15 # description: IBM WebSphere Application Server is a powerful \ # middleware platform for connecting Web-based applications and \ # servers. # Path to the WebSphere startup and shutdown scripts startscript=/opt/IBM/WebSphere/AppServer/bin/startServer.sh shutscript=/opt/IBM/WebSphere/AppServer/bin/stopServer.sh prog="the WebSphere Application Server" RETVAL=0 # modify the following line as needed to reflect any custom Java # installation directory PATH=/opt/IBM/ibm-java-x86_64_60/bin:$PATH # Function to start the server start() { echo -n $"Starting $prog: " $startscript server1 RETVAL=$? echo return $RETVAL } # Function to stop the server stop() { echo -n $"Stopping $prog: " $shutscript server1 -username ADMINUSER -password PASSWORD RETVAL=$? echo return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac exit $RETVAL |
To download and install the sample SysVInit script, perform the following steps:
- Download the sample script.
- Save this file to your system and copy it to /etc/init.d as the root user (or by using the
sudo
command), giving it a name such as websphere_sysvinit.sh. - Edit this file using your favorite text editor, changing ADMINUSER and PASSWORD to the administrative username and password that you defined during the installation process, and save those changes.
- As the root user or by using
sudo
, make the file executable using this command:chmod 755 /etc/init.d/websphere_sysvinit.sh
- Create symbolic links to this file from the directory associated with your system's default runlevel (usually the /etc/rc5.d directory for a graphical system or the /etc/rc3.d directory for a system that uses a text console) by using commands like the following:
ln -s /etc/init.d/websphere_sysvinit.sh /etc/rc5.d/S85ibm-was ln -s /etc/init.d/websphere_sysvinit.sh /etc/rc5.d/K15ibm-was
Create an Ubuntu Upstart script
The Ubuntu Linux distribution uses an alternate startup mechanism to the SysVInit mechanism. The Ubuntu startup mechanism is known as Upstart (see Resources) and is a relatively new, event-driven startup mechanism that was created for Ubuntu but is being adopted by other distributions such as Fedora and, therefore, eventually Red Hat and Centos. Upstart is becoming popular largely because of its support for concurrency and responsiveness to system events.
At the moment, Upstart is implemented to be compatible with the traditional SysVInit model. See Downloads for a simple Upstart script that you can put in the /etc/init.d directory on your system and use for WebSphere Application Server. This script looks like Listing 2.
Listing 2. Sample Upstart script
#!/bin/bash -e ### BEGIN INIT INFO # Provides: ibm-websphere # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/stop IBM WebSphere Application Server ### END INIT INFO # # IBM WAS This init.d script starts the IBM WebSphere # Application Server. # modify the following line as needed to reflect any custom Java # installation directory ENV="env -i LANG=C PATH=/opt/IBM/ibm-java-x86_64_60/bin:/usr/bin:/bin" set -e if [ ! -d /opt/IBM/WebSphere/AppServer/bin ] ; then echo "No IBM WebSphere Application Server installed" exit 0 fi . /lib/lsb/init-functions test -f /etc/default/rcS && . /etc/default/rcS startscript=/opt/IBM/WebSphere/AppServer/bin/startServer.sh shutscript=/opt/IBM/WebSphere/AppServer/bin/stopServer.sh case $1 in start) log_daemon_msg "Starting application server" "IBM WAS" if $startscript ; then log_end_msg 0 else log_end_msg 1 fi ;; stop) log_daemon_msg "Stopping application server" "IBM WAS" if $stopscript -user was-admin -password PASSWORD; then log_end_msg 0 else log_end_msg 1 fi restart) log_daemon_msg "Restarting Web server" "IBM HTTP" if ($stopscript -user was-admin -password PASSWORD && $startscript) then log_end_msg 0 else log_end_msg 1 fi ;; *) log_success_msg "Usage: /etc/init.d/websphere {start|stop|restart}" exit 1 ;; esac |
After downloading this file, perform the following steps:
- Save this file to your system and copy it to /etc/init.d as the root user (or by using the
sudo
command), giving it a name such as websphere_upstart.sh. - As the root user or by using the
sudo
command, make the file executable by using this command:chmod 755 /etc/init.d/websphere_upstart.sh
- Create symbolic links to this file from the directory associated with your system's default runlevel (usually the /etc/rc2.d directory) by using the commands like the following:
ln -s /etc/init.d/websphere_upstart.sh /etc/rc2.d/S91ibm-was ln -s /etc/init.d/websphere_upstart.sh /etc/rc2.d/K15ibm-was
댓글 없음:
댓글 쓰기