Oracle Linux 7.1 透過systemctl將Weblogic設定為開機自啟動
1 說明
設定開機自啟動,需要用到systemctl工具。systemctl是一個systemd工具,主要負責控制systemd系統和服務管理器。systemd是一個系統管理守護程式、工具和庫的集合,用於取代System V初始程式。Systemd的功能是用於集中管理和配置類UNIX系統。
2 準備
作業系統:Oracle Linux 7.1
systemctl --version : systemd 208
weblogic version:12.2.1.3.0
3 編寫系統服務檔案
3.1 adminserver 系統服務檔案
[root@localhost system]# vi weblogic.service [Unit] Description=WebLogic Adminserver Service[Service] [Service] Type=simple WorkingDirectory=/weblogic/Oracle/Middleware/user_projects/domains/base_domain ExecStart=/weblogic/Oracle/Middleware/user_projects/domains/base_domain/bin/startWebLogic.sh ExecStop=/weblogic/Oracle/Middleware/user_projects/domains/base_domain/bin/stopWebLogic.sh User=weblogic Group=weblogic [Install] WantedBy=multi-user.target
3.2 配置weblogic將日誌輸出到指定檔案${DOMAIN_HOME}/admin.log,也就是在以下命令後面加上>"${DOMAIN_HOME}/admin.log" 2>&1
[weblogic@localhost bin]$ vi startWebLogic.sh if [ "${WLS_REDIRECT_LOG}" = "" ] ; then echo "Starting WLS with line:" echo "${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} ${LAUNCH_ARGS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WLS_POLICY_FILE} ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}" ${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} ${LAUNCH_ARGS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WLS_POLICY_FILE} ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS} >"${DOMAIN_HOME}/admin.log" 2>&1 else echo "Redirecting output from WLS window to ${WLS_REDIRECT_LOG}" ${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} ${LAUNCH_ARGS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WLS_POLICY_FILE} ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS} >"${DOMAIN_HOME}/admin.log" 2>&1
3.3 檢視系統服務檔案是否被識別
[root@localhost system]# systemctl list-unit-files|grep weblogic weblogic.service disabled 3.4 禁用防火牆和SELinux
[root@localhost system]# setenforce 0 [root@localhost system]# sed -i "/^SELINUX=/s#enforcing#disabled#" /etc/selinux/config [root@localhost system]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted [root@localhost system]# systemctl is-enabled firewalld enabled [root@localhost system]# systemctl status firewalld firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) Active: active (running) since Fri 2023-03-31 14:11:15 CST; 1h 16min ago Main PID: 602 (firewalld) CGroup: /system.slice/firewalld.service └─602 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid Mar 31 14:11:15 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon. [root@localhost system]# systemctl stop firewalld [root@localhost system]# systemctl disable firewalld rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service' rm '/etc/systemd/system/basic.target.wants/firewalld.service' [root@localhost system]# systemctl is-enabled firewalld disabled [root@localhost system]# firewall-cmd --zone=public --list-ports FirewallD is not running
4 測試系統服務
4.1 啟動系統服務
[root@localhost system]# systemctl start weblogic.service
[root@localhost base_domain]# tail -f admin.log
<Mar 31, 2023 3:56:09 PM CST> <Info> <Security> <BEA-090905> <Disabling the CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true.>
<Mar 31, 2023 3:56:09 PM CST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG128 to HMACDRBG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true.>
<Mar 31, 2023 3:56:10 PM CST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) 64-Bit Server VM Version 25.131-b11 from Oracle Corporation.>
<Mar 31, 2023 3:56:10 PM CST> <Info> <RCM> <BEA-2165021> <"ResourceManagement" is not enabled in this JVM. Enable "ResourceManagement" to use the WebLogic Server "Resource Consumption Management" feature. To enable "ResourceManagement", you must specify the following JVM options in the WebLogic Server instance in which the JVM runs: -XX:+UnlockCommercialFeatures -XX:+ResourceManagement.>
<Mar 31, 2023 3:56:10 PM CST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 12.2.1.3.0 Thu Aug 17 13:39:49 PDT 2017 1882952>
<Mar 31, 2023 3:59:53 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.>
<Mar 31, 2023 3:59:53 PM CST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool.>
<Mar 31, 2023 3:59:53 PM CST> <Info> <WorkManager> <BEA-002942> <CMM memory level becomes 0. Setting standby thread pool size to 256.>
<Mar 31, 2023 4:01:39,810 PM CST> <Notice> <Log Management> <BEA-170019> <The server log file weblogic.logging.FileStreamHandler instance=460171696
Current log file=/weblogic/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/logs/AdminServer.log
Rotation dir=/weblogic/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/logs
is opened. All server side log events will be written to this file.>
<Mar 31, 2023 4:01:40,077 PM CST> <Notice> <Security> <BEA-090946> <Security pre-initializing using security realm: myrealm>
<Mar 31, 2023 4:01:40,771 PM CST> <Notice> <Security> <BEA-090947> <Security post-initializing using security realm: myrealm>
<Mar 31, 2023 4:01:41,826 PM CST> <Notice> <Security> <BEA-090082> <Security initialized using administrative security realm: myrealm>
<Mar 31, 2023 4:01:42,631 PM CST> <Notice> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://10.138.130.64:7001/jndi/weblogic.management.mbeanservers.runtime.>
4.2 停止系統服務
[root@localhost system]# systemctl stop weblogic.service
5 將服務設定成開機自啟動
[root@localhost system]# systemctl enable weblogic.service ln -s '/etc/systemd/system/weblogic.service' '/etc/systemd/system/multi-user.target.wants/weblogic.service' [root@localhost system]# systemctl list-unit-files|grep weblogic weblogic.service enabled
反向命令:
[root@localhost system]# systemctl disable weblogic.service rm '/etc/systemd/system/multi-user.target.wants/weblogic.service' [root@localhost system]# systemctl list-unit-files|grep weblogic weblogic.service disabled
6 重啟伺服器並檢查weblogic是否自啟動
[root@localhost system]#reboot [root@localhost ~]# ps -ef | grep java weblogic 721 1 0 16:13 ? 00:00:01 /usr/java/jdk1.8.0_131/bin/java -Dderby.system.home=/weblogic/Oracle/Middleware/user_projects/domains/base_domain/common/db -classpath /weblogic/Oracle/Middleware/wlserver/common/derby/lib/derby.jar:/weblogic/Oracle/Middleware/wlserver/common/derby/lib/derbynet.jar:/weblogic/Oracle/Middleware/wlserver/common/derby/lib/derbytools.jar:/weblogic/Oracle/Middleware/wlserver/common/derby/lib/derbyclient.jar org.apache.derby.drda.NetworkServerControl start weblogic 722 645 6 16:13 ? 00:01:07 /usr/java/jdk1.8.0_131/bin/java -server -Xms256m -Xmx512m -XX:CompileThreshold=8000 -cp /weblogic/Oracle/Middleware/wlserver/server/lib/weblogic-launcher.jar -Dlaunch.use.env.classpath=true -Dweblogic.Name=AdminServer -Djava.security.policy=/weblogic/Oracle/Middleware/wlserver/server/lib/weblogic.policy -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader -javaagent:/weblogic/Oracle/Middleware/wlserver/server/lib/debugpatch-agent.jar -da -Dwls.home=/weblogic/Oracle/Middleware/wlserver/server -Dweblogic.home=/weblogic/Oracle/Middleware/wlserver/server weblogic.Server root 3094 3019 0 16:31 pts/0 00:00:00 grep --color=auto java
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2943185/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- systemctl 命令設定開機自啟動失敗
- Linux平臺Oracle開機自啟動設定LinuxOracle
- linux中透過systemctl建立服務並實現開機啟動Linux
- Oracle Linux 7.1 靜默安裝Weblogic 12.2.1.3OracleLinuxWeb
- TongWeb在Linux下設定開機自啟動WebLinux
- Linux MySQL 服務設定開機自啟動LinuxMySql
- Linux Redis 服務設定開機自啟動LinuxRedis
- linux設定開機啟動Linux
- linux7 開機自啟動oracleLinuxOracle
- 【OEM】Oracle oem取消開機自動啟動(linux)OracleLinux
- linux設定開機自啟動指令碼的最佳方式Linux指令碼
- oracle配置開機自啟動Oracle
- 設定開機自啟動nginx和httpdNginxhttpd
- Ubuntu 設定開機自啟動指令碼Ubuntu指令碼
- frp設定開機自啟FRP
- Linux部署的WGCLOUD的探針agent如何設定開機自啟動LinuxGCCloud
- linux server設定開機自動連線WIFILinuxServerWiFi
- windows下redis設定redis開機自啟動WindowsRedis
- centos7.5 設定Mysql開機自啟動CentOSMySql
- Linux CentOS開機啟動項設定命令:chkconfigLinuxCentOS
- Linux 新增開機自啟動Linux
- Linux開機自啟動配置Linux
- 微星主機板透過uefi bios設定開機隨身碟啟動方法步驟iOS
- 設定msyqlphp-fpm開機自動啟動指令碼PHP指令碼
- java程式設定開機自啟Java
- Android設定app開機自啟AndroidAPP
- Linux配置JavaEE環境 Linux中安裝JDK、Tomcat、mysql 設定Tomcat自啟動、設定mysql自啟動LinuxJavaJDKTomcatMySql
- lubuntu設定開機啟動Ubuntu
- win 開機自動輸入密碼 並設定 cmder 開機自啟執行密碼
- 如何設定win10軟體開機自動啟動 win10軟體開機自動啟動的方法Win10
- OracleLinux上的Oracle開關機自啟動OracleLinux
- win10電腦開啟蓋子自動開機怎麼設定 win10翻蓋自動開機設定方法Win10
- Linux 新增指令碼開機自啟動Linux指令碼
- Linux 下軟體開機自啟動Linux
- Linux系統如何設定開機自動執行指令碼?Linux指令碼
- 設定Oracle9i為自動歸檔模式Oracle模式
- 關閉windows更新、設定自啟動、提高開發機效能Windows
- Nginx設定成服務並開機自動啟動的配置詳解Nginx