DB2 Init Script
Here's an init script you can use for DB2 Express-C (maybe other versions.)
You can download the free database at:
http://www-01.ibm.com/software/data/db2/express/download.html
To create a database just:
sudo su - db2inst1 db2 CREATE DATABASE foo PAGESIZE 32768
This will take quite a while. The PAGESIZE is recommended by waveform on freenode #db2.
The init script:
#!/bin/sh # # Startup script for DB2 Personal Edition # # description: DB2 RDBMS System # processname: dataserver DB2_USER=db2inst1 # Find the name of the script NAME=`basename $0` # For SELinux we need to use 'runuser' not 'su' if [ -x /sbin/runuser ] then SU=runuser else SU=su fi # Find home DB2_HOME=`$SU $DB2_USER -c 'echo \$HOME'` start() { DB2_START=$"Starting ${NAME} service: " $SU $DB2_USER -c '. $DB2_HOME/sqllib/db2profile; \ $DB2_HOME/sqllib/adm/db2start > /dev/null' ret=$? if [ $ret -eq 0 ] then echo "$DB2_START Success." else echo "$DB2_START Failed!" exit 1 fi echo } stop() { echo -n $"Stopping ${NAME} service: " $SU $DB2_USER -c '. $DB2_HOME/sqllib/db2profile; \ $DB2_HOME/sqllib/adm/db2stop > /dev/null' ret=$? if [ $ret -eq 0 ] then echo "Success." else echo "Failed!" exit 1 fi echo } restart() { stop start } case "$1" in start) start ;; stop) stop ;; restart) restart ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac exit 0
Last modified: 2010-2-2 (火) at 9:16 pm
Random Stuff