예제 #1
0
?>
### BEGIN INIT INFO
# Provides:          nj
# Required-Start:    $local_fs $remote_fs $network $syslog $named
# Required-Stop:     $local_fs $remote_fs $network $syslog $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# X-Interactive:     true
# Short-Description: Start/stop nj server
### END INIT INFO
<?php 
ob_end_clean();
require dirname(__FILE__) . '/vendor/autoload.php';
Conf::initCommon(dirname(__FILE__) . '/common.ini');
require_once Conf::common()['path']['commonClasses'] . '/inc.php';
DbHandler::connect(Conf::common()['DB']['HOST'], Conf::common()['DB']['DB'], Conf::common()['DB']['USER'], Conf::common()['DB']['PASS']);
define('SCRIPT_TO_LAUNCH', dirname(__FILE__) . '/index.php --idPartie=');
if (!isset($_SERVER['argv'][1])) {
    echo "invalid or excess argument(s)\n";
    exit(2);
}
if (!in_array($_SERVER['argv'][1], array('start', 'stop', 'restart', 'try-restart', 'reload', 'force-reload', 'status'))) {
    echo "invalid or excess argument(s)\n";
    exit(2);
}
switch ($_SERVER['argv'][1]) {
    case 'start':
        if (isRunning()) {
            exit;
        }
        start();
예제 #2
0
 /**
  *
  * Refait la connexion à la DB
  * @return void
  */
 public function reconnectDb()
 {
     DbHandler::connect(Conf::common()['DB']['HOST'], Conf::common()['DB']['DB'], Conf::common()['DB']['USER'], Conf::common()['DB']['PASS']);
 }