1 Description
The system CTL tool is required to set the startup and self start.
systemctl is a systemd tool, which is mainly responsible for controlling systemd system and service manager.
SYSTEMd is a collection of system management daemons, tools, and libraries to replace the System V initial process. The function of SYSTEMd is to centrally manage and configure UNIX like systems.
In the Linux ecosystem, Systemd has been deployed to most standard Linux distributions, only a few have not yet been deployed.
2 preparation
os: redhat7.0
systemctl –version : systemd 208
weblogic version: 12
3 write system service documents
3.1 adminserver system service file
# vi /usr/lib/systemd/system/wls_adminserver.service
----------------------------------------------------
[Unit]
Description=WebLogic Adminserver Service
[Service]
Type=simple
WorkingDirectory=/wl_domains_path/base_domain
ExecStart=/wl_domains_path/base_domain/bin/startWebLogic.sh
ExecStop=/wl_domains_path/base_domain/bin/stopWebLogic.sh
User=weblogic
Group=weblogic
[Install]
WantedBy=multi-user.target
3.2 nodemanager system service file
The Node Manager unit file needs to be written according to the actual situation. If you're not sure if you need to, don't write this file.
# vi /user/lib/systemd/system/wls_nodemanager.service
------------------------------------------------------
[Unit]
Description=WebLogic NodeManager Service
[Service]
Type=simple
WorkingDirectory=/wl_domains_path/base_domain
ExecStart=/wl_domains_path/bin/startNodeManager.sh
ExecStop=/wl_domains_path/bin/stopNodeManager.sh
User=weblogic
Group=weblogic
[Install]
WantedBy=multi-user.target
3.3 check whether the system service file is recognized
# systemctl list-unit-files|grep wls
--------------------------
wls_adminserver.service disabled
wls_nodemanager.service disabled
At this point, the unit file is completed.
4 test system service
4.1 start system service
# systemctl start wls_adminserver.service
4.2 stop system service
# systemctl stop wls_adminserver.service
4.3 check whether the system service is started successfully
# systemctl status wls_adminserver.service -l
4.4 possible 203 errors
ExecStart gives a wrong path to the startup script, and a 203 error will be prompted. It's good to be right
Script resolver is not specified in system service file, and 203 error will be prompted. (add at the beginning of the file: ×! / bin/sh)
5 set the service to power on and start automatically
# systemctl enable wls_adminserver.service
# systemctl enable wls_nodemanager.service
# systemctl list-unit-files|grep wls
--------------------------
wls_adminserver.service enabled
wls_nodemanager.service enabled
Reverse command:
# systemctl disable wls_adminserver.service
# systemctl disable wls_nodemanager.service
# systemctl list-unit-files|grep wls
--------------------------
wls_adminserver.service disabled
wls_nodemanager.service disabled
6 view the console log of the service
Equivalent to tail-f.
# journalctl -flu wls_adminserver.service