You can prepare JCL procedures to start and stop IBM® HTTP Server from the MVS™ system console.
By using a JCL cataloged procedure to issue the apachectl start and stop commands, you can start and stop an IBM HTTP Server instance from the MVS system console. Other apachectl commands can be issued from the MVS system console using the same procedure.
Copy the following sample JCL procedure from SHAPJCL(HAPAPROC) to your system procedure library:
//*---------------------------------------------------------
//IHSAPACH PROC ACTION='start',
// DIR='/path/to/IHS/runtime/directory',
// CONF='conf/httpd.conf'
//*---------------------------------------------------------
//IHS EXEC PGM=BPXBATCH,
// PARM='SH &DIR/bin/apachectl -k &ACTION -f &CONF -DNO_DETACH',
// MEMLIMIT=512M
//STDOUT DD PATH='&DIR/logs/proc.output',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=(SIRUSR,SIWUSR,SIRGRP,SIWGRP)
//STDERR DD PATH='&DIR/logs/proc.errors',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=(SIRUSR,SIWUSR,SIRGRP,SIWGRP)
// PEND
/*------------------------------------------------------
//WEBFTNEI JOB (KOMA-Y98),'Apache NZX2 ',MSGCLASS=T,
// TIME=NOLIMIT
// EXPORT SYMLIST=*
//*-------------------------------------
// SET ACTION='start'
// SET DIR='/home/ihsa/install/webft'
// SET CONF='../../httpd/webftnei.conf'
//*-----------------------------------------------------
//IHS EXEC PGM=BPXBATCH,PARMDD=PARMIN,
// MEMLIMIT=512M
//PARMIN DD *,SYMBOLS=JCLONLY
PGM &DIR/bin/apachectl
-k &ACTION
-f &CONF
-DNO_DETACH
//*-------------------------------------------------------
//STDOUT DD SYSOUT=T
//*
//STDERR DD SYSOUT=T
//*
//
//STDOUT DD PATH='&DIR/logs/proc.output',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=(SIRUSR,SIWUSR,SIRGRP,SIWGRP)
//*
//STDERR DD PATH='&DIR/logs/proc.errors',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=(SIRUSR,SIWUSR,SIRGRP,SIWGRP)
//
/*----------------------------------------------------------
A description of the apachectl command used in the sample JCL can be found at the Apache HTTP Server Control Interface Web site.
The default jobname for the IBM HTTP Server instance will be the same as the member name of
the cataloged procedure. The Web server is a multi-process server, and each additional process that
is created will have a generated jobname that is based on the original jobname. If the original
jobname is 8 characters long, then all the additional processes will have the same jobname. If the
original jobname is less then 8 characters then the additional processes will have jobnames that are
composed of the original jobname with an added digit as a suffix. If the Web server is started from
the UNIX environment using the bin/apachectl command, then the default jobname will
be the userid that the command is running under. As with the jobname, if the userid is 8 characters
long, then all the additional processes will have the same jobname. If the userid is less then 8
characters then the processes will have jobnames that are composed of the userid with an added digit
as a suffix.
RDEFINE STARTED WEBSRV1.* STDATA(USER(WWWSERV) GROUP(WWWGROUP) TRACE(YES))
SETROPTS RACLIST(STARTED) GENERIC(STARTED) REFRESH
S WEBSRV1
S WEBSRV1,JOBNAME=HTTPDWS1![[Updated in March 2014]](../images/deltaend.gif)
P WEBSRV1
S WEBSRV1,ACTION='stop'
S WEBSRV1,ACTION='<command>'
S WEBSRV1,ACTION=restart
You can restart the server from the z/OS
console.S WEBSRV1,ACTION=graceful
You can gracefully restart the server from the
z/OS console.The output files for the start and stop commands are located in the files
specified on the STDOUT and STDERR DD JCL statements in the procedure
.
LoadModule zos_cmds_module modules/mod_zos_cmds.so
BPXM023I (WASTST1) IHS is active. Use jobname HTTPDWS1 for MVS commands.
where
WASTST1 is the userid that the Web server is running under. An entry will be
written to the error log that identifies the jobname as well. Notice that the
mod_zos_cmds daemon jobname is HTTPDWS1. When a MODIFY command is
entered, it gets targeted to every job with the specified jobname. Only one of the Web server
processes will accept the command. The system will issue the following message for each of the other
jobs of the same jobname. The message will only be prefixed by message ID BPXM023I
and a userid if the userid under which the HTTP server is running cannot access the BPX.CONSOLE
FACILITY class.IEE342I MODIFY REJECTED-TASK BUSY
P HTTPDWS1
F HTTPDWS1,appl='restart'
F HTTPDWS1,appl='graceful'
BPXM023I (WASTST1) IHS is stopping
where WASTST1 is the userid that the Web
server is running under.