1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
|
#!/bin/sh
INITDIR=/etc/rc.d/init.d
HTTPDINIT=$INITDIR/httpd
PHPDIR=/var/www/html
DB2USER=db2inst3
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" = "msql" )
then
ARGS="localhost 8005 \"\" msqltest msqltest"
PHPARGS="host=localhost&port=8005&socket=&user=msqltest&password=msqltest"
sudo $INITDIR/msql start
sudo sqlr-start -id msqltest
fi
if ( test "$DB" = "mysql" )
then
ARGS="localhost 8006 \"\" mysqltest mysqltest"
PHPARGS="host=localhost&port=8006&socket=&user=mysqltest&password=mysqltest"
sudo $INITDIR/mysqld start
sudo sqlr-start -id mysqltest
fi
if ( test "$DB" = "oldmysql" )
then
ARGS="localhost 8006 \"\" mysqltest mysqltest"
PHPARGS="host=localhost&port=8006&socket=&user=mysqltest&password=mysqltest"
sudo $INITDIR/mysqld start
sudo sqlr-start -id mysqltest
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" = "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 \"\" pgsqlrouter pgsqlrouter"
PHPARGS="localhost 9000 \"\" pgsqlrouter pgsqlrouter"
PHPARGS="host=localhost&port=9000&socket=&user=pgsqlrouter&password=pgsqlrouter"
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 pgsqlrouter
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" = "msql" )
then
sudo $INITDIR/msql stop
fi
if ( test "$DB" = "mysql" )
then
sudo $INITDIR/mysqld stop
fi
if ( test "$DB" = "oldmysql" )
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" = "sybase" )
then
sudo $INITDIR/sybase stop
fi
if ( test "$DB" = "router" )
then
sudo $INITDIR/postgresql stop
sudo $INITDIR/oracle stop
fi
|