Results 1 to 6 of 6
I have a bash file to start sybase database and vitalqip services. How do I make it auto start everytime I reboot the server? Please assist me. Thanks in advance ...
- 09-18-2009 #1Just Joined!
- Join Date
- Sep 2009
- Posts
- 5
How to auto start bash file when server reboot?
I have a bash file to start sybase database and vitalqip services. How do I make it auto start everytime I reboot the server? Please assist me. Thanks in advance Below will be the script:
#! /bin/sh
. /opt/sybase/SYBASE.sh
. /opt/qip/etc/shrc
case "$1"
in
'start')
# QIP Startup BEGIN.
# Start the Sybase Database Server QIPSYBASE
#
if [ -f /opt/sybase/ASE-15_0/install/RUN_BOLMDDVI01 ]
then
echo "Starting Sybase"
/opt/sybase/ASE-15_0/install/RUN_BOLMDDVI01 > /opt/sybase/ASE-15_0/install/BOLMD
DVI01.log 2>&1 &
#
# Wait for Sybase Server to finish starting.
#
sleep 20
fi
#
# Start Sybase Backup server. Check if you want this (i.e you need to do Sybase
dumps)
# Also check if the name is correct
if [ -f /opt/sybase/ASE-15_0/install/RUN_BOLMDDVI01_BS ]
then
echo "Starting Sybase Backup server"
/opt/sybase/ASE-15_0/install/RUN_BOLMDDVI01_BS > /opt/sybase/ASE-15_0/install/BO
LMDDVI01_BS.log 2>&1 &
fi
# Start QIP daemons
echo "Starting the QIP daemons"
#
if [ -f /opt/qip/etc/qip-es-startup ]
then
echo "Starting qip-es-startup"
/opt/qip/etc/qip-es-startup
fi
if [ -f /opt/qip/etc/qip-rs-startup ]
then
echo "Starting qip-rs-startup"
/opt/qip/etc/qip-rs-startup
fi
if [ -f /opt/qip/startTomcat.sh ]
then
echo "Starting Tomcat"
/opt/qip/startTomcat.sh > /dev/null 2>&1
fi
;;
'stop')
. /opt/sybase/SYBASE.sh
. /opt/qip/etc/shrc
# For the following command sequence, the commands that get sent to
# isql must be all the way to the left column without any spaces.
# otherwise the script will end with a syntax error.
isql -U sa -P <<!DONE
shutdown
go
!DONE
if [ -f /opt/qip/stopTomcat.sh ]
then
echo "Stopping Tomcat"
/opt/qip/stopTomcat.sh > /dev/null 2>&1
fi
echo "Stopping QIP"
kill -9 `ps -ef | grep qip-qipupdated | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep qipd | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep qip-dnsupdated | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep qip-rmisched | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep qip-logind | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep qip-ssltd | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep qip-msgd | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep dhcpd | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep qip-netd | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep qip-cached | grep -v grep | awk '{print $2}'`
kill -9 `ps -ef | grep qip-rmtd | grep -v grep | awk '{print $2}'`
;;
*)
echo "unknown Option. Unable to stop/start QIP Processes"
exit 1
esac
- 09-18-2009 #2Just Joined!
- Join Date
- Sep 2009
- Location
- Area 51
- Posts
- 4
Hi,
You might want to add the file to the rc.local so that it executes at every startup. Edit the /etc/rc.local & add the path to the script in the bottom of that file.
- 09-18-2009 #3Just Joined!
- Join Date
- Jun 2009
- Posts
- 7
Hi
You can add the below line to /etc/rc.local file, which executes this file whenever the system reboots.
sh <scriptname>
- 09-19-2009 #4Just Joined!
- Join Date
- Sep 2009
- Posts
- 5
It works!!! Thanks a lot!!! It really helps a lot!!! Thanks again!!!
- 09-22-2009 #5
- 09-24-2009 #6Just Joined!
- Join Date
- Aug 2009
- Posts
- 9
You will find there is a file in /etc/rc.d/rc.local, please open the file and give the location of those script so when ever your server will be rebooted it will automaticall execute the script from there


Reply With Quote
