From: <tr...@us...> - 2003-02-10 08:41:15
|
Update of /cvsroot/basedb/basedb/bin In directory sc8-pr-cvs1:/tmp/cvs-serv29789/bin Modified Files: startBase.php stopBase.php Added Files: base.server Log Message: Work done on laptop in Gothenburg - no time for more detailed message --- NEW FILE: base.server --- #! /bin/sh # ### BEGIN INIT INFO # Provides: base # Required-Start: mysql apache # Required-Stop: # Default-Start: 3 5 # Default-Stop: # Description: BASE, http://base.thep.lu.se ### END INIT INFO . /etc/rc.status . /etc/rc.config baseroot=/usr/local/base baseuser=base test -x "$baseroot/bin" || exit 0 rc_reset case "$1" in start) echo -n "Starting BASE: " su $baseuser -c "$baseroot/bin/startBase.php >/dev/null" rc_status -v ;; stop) echo -n "Shutting down BASE: " su $baseuser -c \ "$baseroot/bin/stopBase.php 'Shut down by the system' >/dev/null" rc_status -v ;; restart) ## If first returns OK call the second, if first or ## second command fails, set echo return value. $0 stop; sleep 1 && $0 start rc_status ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; esac rc_exit Index: startBase.php =================================================================== RCS file: /cvsroot/basedb/basedb/bin/startBase.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** startBase.php 3 Feb 2003 13:11:55 -0000 1.2 --- startBase.php 10 Feb 2003 08:40:40 -0000 1.3 *************** *** 56,60 **** if($BC->mayRun()) ! mydie("BASE is already running\n"); // Open database connection --- 56,65 ---- if($BC->mayRun()) ! { ! mydie("BASE is already running. If you did an unclean shutdown ". ! "of BASE\n". ! "(without using stopBase.php), you may want to run ". ! "checkDatabase.php\n"); ! } // Open database connection *************** *** 65,68 **** --- 70,82 ---- } unset($config["dbPassword"]); + + $state = $BC->getState(); + if($state && $state["pendingTransactions"]) + { + mydie("There are pending transactions according to the database.\n". + "The stopBase.php script may provide more information, or you\n". + "can just update the row in table BaseControl after verifying\n". + "that it's incorrect.\n"); + } if(!$BC->endShutdown()) Index: stopBase.php =================================================================== RCS file: /cvsroot/basedb/basedb/bin/stopBase.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** stopBase.php 3 Feb 2003 13:11:55 -0000 1.2 --- stopBase.php 10 Feb 2003 08:40:40 -0000 1.3 *************** *** 40,67 **** $BC = new BaseControl(); - if(!$BC->mayRun()) - mydie("BASE is already shut down\n"); ! // Open database connection ! db_connect($config["dbHost"], $config["dbUser"], $config["dbPassword"], $config["dbDatabase"]); unset($config["dbPassword"]); [...72 lines suppressed...] mydie("Unable to initiate shutdown\n"); ob_implicit_flush(1); ! $down = $BC->waitForShutdown(10); ! if(!$down) { ! fwrite(STDERR, "Waiting for locks (10 min max): "); ! // Wait for ten minutes ! for($i = 0; !$down && $i < 24; $i++) ! { ! fwrite(STDERR, "."); ! $down = $BC->waitForShutdown(25); ! } ! fwrite(STDERR, "\n"); } if(!$down) { ! mydie("Timed out after 10 minutes. ". "Manual intervention will be needed.\n"); } |