#!/bin/sh INITDIR=/etc/rc.d/init.d HTTPDINIT=$INITDIR/httpd PHPDIR=/var/www/html DB2USER=db2inst1 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:@prefix@/java/com/firstworks/sqlrelay export CLASSPATH=$CLASSPATH:./:@prefix@/java/sqlrelay.jar DB=$1 API=$2 if ( test "$DB" = "db2" ) then ARGS="localhost 8001 \"\" db2test db2test" PHPARGS="host=localhost&port=8001&socket=&user=db2test&password=db2test" sudo $INITDIR/db2 start sudo su -l $DB2USER -c "sqlr-start -id db2test" fi if ( test "$DB" = "freetds" ) then ARGS="localhost 8002 \"\" freetdstest freetdstest" PHPARGS="host=localhost&port=8002&socket=&user=freetdstest&password=freetdstest" sudo $INITDIR/sybase start sleep 5 sudo sqlr-start -id freetdstest fi if ( test "$DB" = "interbase" ) then ARGS="localhost 8003 \"\" interbasetest interbasetest" PHPARGS="host=localhost&port=8003&socket=&user=interbasetest&password=interbasetest" sudo $INITDIR/firebird start sudo sqlr-start -id interbasetest fi if ( test "$DB" = "mysql3" ) then ARGS="localhost 8006 \"\" mysql3test mysql3test" PHPARGS="host=localhost&port=8006&socket=&user=mysql3test&password=mysql3test" sudo $INITDIR/mysqld start sudo sqlr-start -id mysql3test fi if ( test "$DB" = "mysql412" ) then ARGS="localhost 8006 \"\" mysql412test mysql412test" PHPARGS="host=localhost&port=8006&socket=&user=mysql412test&password=mysql412test" sudo $INITDIR/mysqld start sudo sqlr-start -id mysql412test fi if ( test "$DB" = "mysql5" ) then ARGS="localhost 8006 \"\" mysql5test mysql5test" PHPARGS="host=localhost&port=8006&socket=&user=mysql5test&password=mysql5test" sudo $INITDIR/mysqld start sudo sqlr-start -id mysql5test fi if ( test "$DB" = "oracle7" ) then ARGS="localhost 8008 \"\" oracle7test oracle7test" PHPARGS="host=localhost&port=8008&socket=&user=oracle7test&password=oracle7test" sudo $INITDIR/oracle start sleep 5 sudo sqlr-start -id oracle7test fi if ( test "$DB" = "oracle8" ) then ARGS="localhost 8009 \"\" oracle8test oracle8test" PHPARGS="host=localhost&port=8009&socket=&user=oracle8test&password=oracle8test" sudo $INITDIR/oracle start sleep 5 sudo sqlr-start -id oracle8test fi if ( test "$DB" = "oracle8i" ) then ARGS="localhost 8009 \"\" oracle8test oracle8test" PHPARGS="host=localhost&port=8009&socket=&user=oracle8test&password=oracle8test" sudo $INITDIR/oracle start sleep 5 sudo sqlr-start -id oracle8test fi if ( test "$DB" = "postgresql6" ) then ARGS="localhost 8010 \"\" postgresql7test postgresql7test" PHPARGS="host=localhost&port=8010&socket=&user=postgresql7test&password=postgresql7test" sudo $INITDIR/postgresql start sudo sqlr-start -id postgresql7test fi if ( test "$DB" = "postgresql7" ) then ARGS="localhost 8010 \"\" postgresql7test postgresql7test" PHPARGS="host=localhost&port=8010&socket=&user=postgresql7test&password=postgresql7test" sudo $INITDIR/postgresql start sudo sqlr-start -id postgresql7test fi if ( test "$DB" = "postgresql8" ) then ARGS="localhost 8010 \"\" postgresql8test postgresql8test" PHPARGS="host=localhost&port=8010&socket=&user=postgresql8test&password=postgresql8test" sudo $INITDIR/postgresql start sudo sqlr-start -id postgresql8test fi if ( test "$DB" = "odbc" ) then ARGS="localhost 8013 \"\" odbctest odbctest" PHPARGS="host=localhost&port=8013&socket=&user=odbctest&password=odbctest" sudo $INITDIR/postgresql start sudo sqlr-start -id odbctest fi if ( test "$DB" = "sqlite" ) then ARGS="localhost 8011 \"\" sqlitetest sqlitetest" PHPARGS="host=localhost&port=8011&socket=&user=sqlitetest&password=sqlitetest" sudo sqlr-start -id sqlitetest fi if ( test "$DB" = "sybase" ) then ARGS="localhost 8012 \"\" sybasetest sybasetest" PHPARGS="localhost 8012 \"\" sybasetest sybasetest" PHPARGS="host=localhost&port=8012&socket=&user=sybasetest&password=sybasetest" sudo $INITDIR/sybase start sleep 5 sudo sqlr-start -id sybasetest fi if ( test "$DB" = "router" ) then ARGS="localhost 9000 \"\" routertest routertest" PHPARGS="localhost 9000 \"\" routertest routertest" PHPARGS="host=localhost&port=9000&socket=&user=routertest&password=routertest" sudo $INITDIR/postgresql start sudo $INITDIR/oracle start sleep 5 sudo sqlr-start -id pgsqldb1 sudo sqlr-start -id pgsqldb2 sudo sqlr-start -id oracle8test sudo sqlr-start -id routertest fi if ( test "$API" = "c" -o -z "$API" ) then echo echo "C:" cd c ./$DB $ARGS rm -f cachefile* sqlnet.log cd .. fi if ( test "$API" = "c++" -o -z "$API" ) then echo echo "C++:" cd c++ ./$DB $ARGS rm -f cachefile* sqlnet.log cd .. fi if ( test "$API" = "java" -o -z "$API" ) then if ( test "@HAVE_JAVA@" = "yes" ) then echo echo "Java:" cd java java $DB $ARGS rm -f cachefile* sqlnet.log cd .. fi fi if ( test "$API" = "perl" -o -z "$API" ) then if ( test "@HAVE_PERL@" = "yes" ) then echo echo "Perl:" cd perl perl $DB.pl $ARGS rm -f cachefile* sqlnet.log cd .. fi fi if ( test "$API" = "python" -o -z "$API" ) then if ( test "@HAVE_PYTHON@" = "yes" ) then echo echo "Python:" cd python python $DB.py $ARGS rm -f cachefile* sqlnet.log cd .. fi fi if ( test "$API" = "ruby" -o -z "$API" ) then if ( test "@HAVE_RUBY@" = "yes" ) then echo echo "Ruby:" cd ruby ruby $DB.rb $ARGS rm -f cachefile* sqlnet.log cd .. fi fi if ( test "$API" = "php" -o -z "$API" ) then if ( test "@HAVE_PHP@" = "yes" ) then echo echo "PHP:" cd php sudo $HTTPDINIT start sleep 1 chmod 755 $DB.php sudo cp $DB.php $PHPDIR lynx -dump -source "http://localhost/$DB.php?$PHPARGS" sudo $HTTPDINIT stop sudo rm -f /tmp/cachefile* sqlnet.log cd .. fi fi if ( test "$API" = "tcl" -o -z "$API" ) then if ( test "@HAVE_TCL@" = "yes" ) then echo echo "TCL:" cd tcl tclsh $DB.tcl $ARGS rm -f cachefile* sqlnet.log cd .. fi fi if ( test "$DB" = "db2" ) then sudo su -l $DB2USER -c "sqlr-stop" sudo $INITDIR/db2 stop else sudo sqlr-stop fi if ( test "$DB" = "freetds" ) then sudo $INITDIR/sybase stop fi if ( test "$DB" = "interbase" ) then sudo $INITDIR/firebird stop fi if ( test "$DB" = "mysql3" ) then sudo $INITDIR/mysqld stop fi if ( test "$DB" = "mysql412" ) then sudo $INITDIR/mysqld stop fi if ( test "$DB" = "mysql5" ) then sudo $INITDIR/mysqld stop fi if ( test "$DB" = "oracle7" ) then sudo $INITDIR/oracle stop fi if ( test "$DB" = "oracle8" ) then sudo $INITDIR/oracle stop fi if ( test "$DB" = "oracle8i" ) then sudo $INITDIR/oracle stop fi if ( test "$DB" = "postgresql6" ) then sudo $INITDIR/postgresql stop fi if ( test "$DB" = "postgresql7" ) then sudo $INITDIR/postgresql stop fi if ( test "$DB" = "postgresql8" ) then sudo $INITDIR/postgresql stop fi if ( test "$DB" = "odbc" ) then sudo $INITDIR/postgresql stop fi if ( test "$DB" = "sybase" ) then sudo $INITDIR/sybase stop fi if ( test "$DB" = "router" ) then sudo $INITDIR/postgresql stop sudo $INITDIR/oracle stop fi