7.2.1 Setting services to start and stop automatically
To automatically start process management (including user management), the event service, and the log-file trap management daemon when the system starts up, run the following script after completing the installation and setup:
cd /etc/opt/jp1base cp -p jbs_start.model jbs_start
To automatically end process management (including user management) and the event service when the system shuts down, run the following script after completing the installation and setup:
cd /etc/opt/jp1base cp -p jbs_stop.model jbs_stop
- Notes
-
-
To automatically start log file trapping, set a log-file trap startup definition file.
-
You can use jbs_start to automatically start a log file trap by editing the jbs_start file as needed. Edit the file so that log file trapping starts after the event service and the log-file trap management daemon have started.
-
The automatic startup and termination settings are specified according to the encoding that is set for the LANG environment variable during installation. However, if the set encoding is not shown in Table 3-5 in 3.4.2 Setting the language (for UNIX), the LANG environment variable is set to C.
-
When you change the language in jp1bs_env.conf or jp1bs_param.conf, you must also change the LANG environment variable of the automatic start script accordingly.
-
The automatic start script (jbs_start) performs an unsetup of the locale settings of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME, and LC_MESSAGES by default.
-
- In AIX environment
-
To automatically start and stop services in an AIX environment, perform the following procedure in addition to the above operations.
-
Specify the settings to automatically start services.
Using the mkitab command, make the following entries in the /etc/inittab file:
mkitab -i hntr2mon "jp1base:2:wait:/etc/opt/jp1base/jbs_start"
-
Check the settings.
Use the lsitab command to check settings in the /etc/inittab file.
lsitab -a
Confirm that the descriptions are in the same order as the order in which the processes start (first hntr2mon (Hitachi Network Objectplaza Trace Library), and then jp1base).
init:2:initdefault:
brc::sysinit:/sbin/rc.boot 3 >/dev/console 2>&1 # Phase 3 of system boot
...
...
hntr2mon:2:once:/opt/hitachi/HNTRLib2/etc/D002start
jp1base:2:wait:/etc/opt/jp1base/jbs_start
Note
When JP1/Base is uninstalled, the entry hntr2mon:2:once:/opt/hitachi/HNTRLib2/etc/D002start is deleted if no other products are using Hitachi Network Objectplaza Trace Library.
-
Specify the settings to automatically stop services.
Using a text editor, add the following lines to the /etc/rc.shutdown file below the descriptions of the programs that require JP1/Base:
test -x /etc/opt/jp1base/jbs_stop && /etc/opt/jp1base/jbs_stop
test -x /opt/hitachi/HNTRLib2/etc/D002stop && /opt/hitachi/HNTRLib2/etc/D002stop
-
Add the description for shutdown processing.
Add the following line to the end of the /etc/rc.shutdown file.
exit 0
If the command that is executed last has a result code other than 0, the /etc/rc.shutdown script will recognize it as an error and interrupt the shutdown processing.
- Notes
-
The automatic startup and termination settings are specified according to the encoding that is set for the LANG environment variable during installation. However, if the set encoding is not shown in Table 3-5 in 3.4.2 Setting the language (for UNIX), the LANG environment variable is set to C.
When you change the language in jp1bs_env.conf or jp1bs_param.conf, you must also change the LANG environment variable of the automatic start script accordingly.
The automatic start script (jbs_start) performs an unsetup of the locale settings of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME, and LC_MESSAGES by default.
In AIX, the OS issues SIGKIL when there is not enough memory. A JP1/Base process might be terminated in this case. To avoid this problem, set the environment variable PSALLOC=early and start JP1/Base.
Set the environment variable NODISCLAIM = true at the same time PSALLOC is set to early.
An example of the setting for an automatic start script is given below.
1. Search for the part below in the automatic script.
export PATH LANG SHLIB_PATH LD_LIBRARY_PATH LIBPATH HCCLIBCNF
2. Add the following lines after the line found in step 1.
PSALLOC=early
NODISCLAIM=true
export PSALLOC NODISCLAIM
-
- In Linux environment
-
To set up automatic startup and automatic termination of JP1/Base, you need to create both of the following files.
/etc/opt/jp1base/jbs_start /etc/opt/jp1base/jbs_stop
When JP1/Base is started or terminated without the files jbs_start and jbs_stop, the following messages are output to the syslog file. Even though the messages below are output to the syslog file, automatic startup and automatic termination are not performed because the settings have not been specified.
At the time of startup: Started JP1/Base Service.
After enabling the JP1/Base automatic startup and termination, if you want to start or stop JP1/Base manually, execute the following command. After executing the command, use the jbs_spmd_status command and jevstat command to check the status of the process.
- Starting JP1/Base
-
For the physical host;
systemctl start jp1_base.service
For the logical host;
systemctl start jp1_base_logical-host-name.service
- Stopping JP1/Base
-
For the physical host;
systemctl stop jp1_base.service
For the logical host;
systemctl stop jp1_base_logical-host-name.service
When you use commands other than the systemctl command, such as jbs_start or jbs_start.cluster, jbs_stop or jbs_stop.cluster, jbs_spmd, and jbs_spmd_stop, to start or stop the program, the automatic stop for JP1/Base will not be performed (the script for stopping the system will not operate but the automatic startup and termination settings remain enabled). If you want JP1/Base to automatically stop when the system stops, perform the operation for activation by executing the systemctl command again. To check whether JP1/Base stops automatically, execute the following command and see whether "active" is displayed.
- For the physical host;
systemctl is-active jp1_base.service
- For the logical host;
systemctl is-active jp1_base_logical-host-name.service
When SELinux is enabled on Linux 8 or later, set the context type to bin_t for jbs_start and jbs_stop.
- A setting example is shown below:
# semanage fcontext -a -t bin_t '/etc/opt/jp1base/jbs_start' # semanage fcontext -a -t bin_t '/etc/opt/jp1base/jbs_stop' # restorecon -F /etc/opt/jp1base/jbs_start # restorecon -F /etc/opt/jp1base/jbs_stop
When SELinux is enabled on Linux 9 or later, set the context type to usr_t for all files in /opt/hitachi/HNTRLib2/etc.
- A setting example is shown below:
# semanage fcontext -a -t usr_t '/opt/hitachi/HNTRLib2/etc(/.*)?' # restorecon -R -F /opt/hitachi/HNTRLib2/etc