linux - script doesn't start on boot with init -
i have following script
#!/bin/sh # chkconfig: 345 99 01 # description: startup script ### begin init info # provides: weblogic # required-start: $local_fs $network $remote_fs # required-stop: $local_fs $network $remote_fs # default-start: 2 3 4 5 # default-stop: 0 1 6 # short-description: start , stop ourdb # description: ourdb fast , reliable database # engine used illustrating init scripts ### end init info . /etc/rc.d/init.d/function service=startweblogic.sh user=******* password=****** dbschemaname=****** hostname=******* port=******** weblogic_start() { pgrep -f startweblogic.sh > /dev/null if ! [ $? -eq 0 ]; echo "exit" | sqlplus -l "$user/$password@(description=(address=(protocol=tcp)(host=$hostname)(port=$port))(connect_data=(sid=$dbschemaname)))" | grep "connected to" > /dev/null if [ $? -eq 0 ]; /home/usr/oracle/middleware/oracle_home/user_projects/domains/econt/bin/startweblogic.sh & else echo "warning! no connection oracle server" | mail -s oracleserverdown monitoring@accedia.com fi else echo "warning! running weblogic service found!" | mail -s "service running" monitoring@accedia.com fi } weblogic_stop() { pgrep -f startweblogic.sh > /dev/null if [ $? -eq 0 ]; /home/usr/oracle/middleware/oracle_home/user_projects/domains/econt/bin/stopweblogic.sh & pid=$! ; sleep 5m; pkill -term -p $pid ps -ef| grep $pid if [ $? -ne 0 ];then pkill -term -p $pid fi pid=`ps -ejh|grep "startweblogic" | grep -iv "grep" | awk '{print $1}'` pkill -term -p $pid else echo "warning! no running weblogic service found" | mail -s "weblogic not found" monitoring@accedia.com fi } case $1 in start) weblogic_start ;; stop) weblogic_stop ;; *) echo "invalid input" ;; esac
i've put in init.d , stuff, chmod-ed , put in rc.local , yet again doesn't want start on boot, though if run manually , passing argument ,e.g. "service weblogic start" works fine , both root , not. has suggestions why acting , there solution ?
you don't need put in init.d
, rc.local
both places. 1 enough.
you may try after put in init.d
:
for debian based os:
sudo update-rc.d script_name defaults
for centos:
chkconfig --add myscript
Comments
Post a Comment