For details about how to enable weblogic in linux-Linux general technology-Linux programming and kernel, refer to the following. Weblogic Automatic Start and Stop
Suppose weblogic is installed in/home/weblogic/bea.
1. Write the service script as follows:
#! /Bin/bash
#
################# FUNCTION #############
#
# AutoStart Weblogic
# AutoStop Weblogic
#
#####################################
#
# Created by ZhouYS 2003-11-26
# Wellhope Information Technology Co., Ltd
# PUJIANG Science Park)
#
Shutdownweblogic ()
{
Cd/
# Make temp work dir, you can create it in/tmp
Mkdir-p/home/weblogic/zhouys
#
Cd/home/weblogic/zhouys
# Find weblogic main process
Ps-aux | grep/home/weblogic>; tmp01
#
Awk '{print $2}' tmp01 | sort>; tmp02
# Produce kill-main-process script
Echo "kill-9" 'sed-n' 1p' tmp02 '>; tmp03
#
Chmod 755 tmp03
# Kill weblogic
./Tmp03
Cd/home/weblogic/
Sleep 3
Rm-rfv zhouys
}
Case "$1" in
Start)
Echo "Starting Weblogic ..."
Echo "-----------------------------------------------" >;>;/var/log/weblogic
Date + "% T % a % D: Starting Weblogic as part of system up." >;>;/var/log/weblogic
Echo "-----------------------------------------------" >;>;/var/log/weblogic
Cd/home/weblogic/bea/user_projects/mydomain/>;>;/dev/null
. StartWebLogic. sh & >;>;/var/log/weblogic
Echo "Done ."
Echo ""
Echo "-----------------------------------------------" >;>;/var/log/weblogic
Date + "% T % a % D: Finished." >;>;/var/log/weblogic
Echo "-----------------------------------------------" >;>;/var/log/weblogic
Touch/var/lock/subsys/weblogic
;;
Stop)
Echo "Stopping Weblogic ..."
Echo "-----------------------------------------------" >;>;/var/log/weblogic
Date + "% T % a % D: Stopping Weblogic as part of system down." >;>;/var/log/weblogic
Echo "-----------------------------------------------" >;>;/var/log/weblogic
Shutdownweblogic
Echo "Done ."
Echo ""
Echo "-----------------------------------------------" >;>;/var/log/weblogic
Date + "% T % a % D: Finished." >;>;/var/log/weblogic
Echo "-----------------------------------------------" >;>;/var/log/weblogic
Name the script weblogic and save it under/etc/rc. d/init. d.
Change file attributes: chmod 755 weblogic
Note: In windows, the file cannot run normally due to DOS format characters when editing the file. We recommend that you use gedit or vi to edit the file. No error control is added to the shutdownweblogic function, you can complete it yourself.
2. Establish a service connection:
To stop weblogic at restart, we need the following link:
[Root @ js-oracle init. d] # ln-s ../init. d/weblogic/etc/rc. d/rc0.d/K01weblogic
[Root @ js-oracle init. d] # ln-s ../init. d/weblogic/etc/rc. d/rc6.d/K01weblogic
When the system starts weblogic, we need the following link:
[Root @ js-oracle init. d] # ln-s ../init. d/weblogic/etc/rc. d/rc2.d/S99weblogic
[Root @ js-oracle init. d] # ln-s ../init. d/weblogic/etc/rc. d/rc3.d/S99weblogic
[Root @ js-oracle init. d] # ln-s ../init. d/weblogic/etc/rc. d/rc5.d/S99weblogic
The above configuration level 4 retains unused on RedHat Advance Server2.1
Iii. Explanation:
When linux is started:
Graphical interface: automatically calls/etc/rc. the symbolic connection name under d/rc5.d starts with S (meaning: start/start) refers to the Service in the script file, and the command line parameter start is automatically passed.
When Linux is disabled:
Graphical interface: automatically calls/etc/rc. the symbolic connection name in d/rc5.d starts with K (meaning: kill/Close) and automatically transmits the command line parameter stop.
Other running levels are similar (For details, refer to the/etc/rc. d/rc Script)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.