fusion1275 |
11-01-2009 05:31 PM |
Thanks for that link.
I have copied the script and amended it using the correct db2 path etc etc.
I've tested the script which I have called db2init with starting it and stopping it manually from the cmd line. All works fine and logs perfectly.
I adding it to /etc/init.d and once it was in the directory I opened the BootUp Manager and ticked the box to have it start on a reboot.
When I rebooted it didnt start and now I cannot see it in the BootUp Managers list.
Here is the script I am using:
Quote:
#!/bin/bash
#
#
# Run-level Startup script for the DB2 Databsse
export DB_USER=db2inst1
export DB2DIR="/opt/ibm/db2/V9.7"
if [ -f /home/db2inst1/sqllib/db2profile ]; then
. /home/db2inst1/sqllib/db2profile
fi
case "$1" in
start)
echo "" >> /var/log/db2.log
echo "----------------------------------------------------" >> /var/log/db2.log
echo "----------------------------------------------------" >> /var/log/db2.log
echo "Starting DB2 Database: " >> /var/log/db2.log
echo "----------------------------------------------------" >> /var/log/db2.log
date +"! %T %a %D : Starting DB2 Database" >> /var/log/db2.log
echo "----------------------------------------------------" >> /var/log/db2.log
echo "Starting DB2 Database: " >> /var/log/db2.log
su $DB_USER -c "$DB2DIR/bin/db2 db2start" >> /var/log/db2.log
su $DB_USER -c "$DB2DIR/bin/db2 activate db sample" >> /var/log/db2.log
echo "Done." >> /var/log/db2.log
echo "" >> /var/log/db2.log
echo "----------------------------------------------------" >> /var/log/db2.log
date +"! %T %a %D : Start completed." >> /var/log/db2.log
echo "----------------------------------------------------" >> /var/log/db2.log
touch /var/lock/db2d
echo "OK"
;;
stop)
echo "Shutting Down DB2 Database:" >> /var/log/db2.log
echo "----------------------------------------------------" >> /var/log/db2.log
date +"! %T %a %D : Shutting Down DB2 Databases" >> /var/log/db2.log
echo "----------------------------------------------------" >> /var/log/db2.log
echo "Shutting Down DB2 Database: " >> /var/log/db2.log
su $DB_USER -c "$DB2DIR/bin/db2 deactivate db sample" >> /var/log/db2.log
su $DB_USER -c "$DB2DIR/bin/db2 db2stop force" >> /var/log/db2.log
echo "Done." >> /var/log/db2.log
echo "" >> /var/log/db2.log
echo "----------------------------------------------------" >> /var/log/db2.log
date +"! %T %a %D : Shutdown completed." >> /var/log/db2.log
echo "----------------------------------------------------" >> /var/log/db2.log
rm -f /var/lock/db2d
echo "OK"
;;
reload|restart)
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >> /var/log/db2.log
echo "DB2 Restart Initiated... " >> /var/log/db2.log
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >> /var/log/db2.log
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0
|
In the logs I can see a shutdown being activated on reboots etc but nothing is appended when the system is being started.
Here is a quick list of the scripts/links:
Quote:
root@Zeus-home:/etc# find . -name "*db2init*"
./rc0.d/K20db2init
./rc1.d/K20db2init
./init.d/db2init
./rc6.d/K20db2init
|
I have even tried to manually add the script using the following:
Quote:
root@Zeus-home:/etc/init.d# update-rc.d db2init start 51 S .
update-rc.d: warning: /etc/init.d/db2init missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
System start/stop links for /etc/init.d/db2init already exist.
|
Cheers for any help
|