Commit c7901f1e authored by Andrey Filippov's avatar Andrey Filippov
Browse files

added output log configuration

parent 7c18ddc3
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -19,5 +19,6 @@ tiff_mx = 65535
tiff_bin_shift = 1
tiff_bin_shift = 1
tiff_auto =  0
tiff_auto =  0
debug =      1
debug =      1
output_log = /var/log/lwir16.log
 # no spaces around commas!
 # no spaces around commas!
CMD =        INIT,START
CMD =        INIT,START
 No newline at end of file
+8 −2
Original line number Original line Diff line number Diff line
@@ -73,6 +73,7 @@
   // daemon control $_GET
   // daemon control $_GET
   define('DAEMON_CTRL',        'daemon');
   define('DAEMON_CTRL',        'daemon');
   define('DAEMON_CTRL_CMDS',   'cmd'); //comma-separated commands to be sent to the daemon
   define('DAEMON_CTRL_CMDS',   'cmd'); //comma-separated commands to be sent to the daemon
   define('OUTPUT_LOG',         'output_log'); // redirect daemon output
   
   
//   print_r($_GET); // magic
//   print_r($_GET); // magic
//   exit(0); // magic
//   exit(0); // magic
@@ -85,6 +86,8 @@
//   $ffc =        false; 
//   $ffc =        false; 
   $GLOBALS[FFC_GROUPS] = 2; // 1/2/4 - do not run FFC on all channels simultaneously (43 failed)
   $GLOBALS[FFC_GROUPS] = 2; // 1/2/4 - do not run FFC on all channels simultaneously (43 failed)
   $GLOBALS[FFC_FRAMES] = 8; // read actual?
   $GLOBALS[FFC_FRAMES] = 8; // read actual?
   $GLOBALS[OUTPUT_LOG] = '/dev/null';
   
   /*
   /*
   $GLOBALS[TIFF_TELEM] =     1; // one top line
   $GLOBALS[TIFF_TELEM] =     1; // one top line
   $GLOBALS[TIFF_MN] =        0;
   $GLOBALS[TIFF_MN] =        0;
@@ -146,6 +149,7 @@
       else if ($key == TIFF_MX)        $GLOBALS[TIFF_MX] =        (int) $value;
       else if ($key == TIFF_MX)        $GLOBALS[TIFF_MX] =        (int) $value;
       else if ($key == TIFF_BIN_SHIFT) $GLOBALS[TIFF_BIN_SHIFT] = (int) $value;
       else if ($key == TIFF_BIN_SHIFT) $GLOBALS[TIFF_BIN_SHIFT] = (int) $value;
       else if ($key == TIFF_AUTO)      $GLOBALS[TIFF_AUTO] =      (int) $value;
       else if ($key == TIFF_AUTO)      $GLOBALS[TIFF_AUTO] =      (int) $value;
       else if ($key == OUTPUT_LOG)     $GLOBALS[OUTPUT_LOG] =           $value;
   }
   }
   if (!isset($GLOBALS[PORT_MASKS])){
   if (!isset($GLOBALS[PORT_MASKS])){
       $GLOBALS[PORT_MASKS] = array();
       $GLOBALS[PORT_MASKS] = array();
@@ -856,6 +860,7 @@ EOT;
       if (isset($arr[TIFF_MX]))         $GLOBALS[TIFF_MX] = (int)          $arr[TIFF_MX];
       if (isset($arr[TIFF_MX]))         $GLOBALS[TIFF_MX] = (int)          $arr[TIFF_MX];
       if (isset($arr[TIFF_BIN_SHIFT]))  $GLOBALS[TIFF_BIN_SHIFT] = (int)   $arr[TIFF_BIN_SHIFT];
       if (isset($arr[TIFF_BIN_SHIFT]))  $GLOBALS[TIFF_BIN_SHIFT] = (int)   $arr[TIFF_BIN_SHIFT];
       if (isset($arr[TIFF_AUTO]))       $GLOBALS[TIFF_AUTO] = (int)        $arr[TIFF_AUTO];
       if (isset($arr[TIFF_AUTO]))       $GLOBALS[TIFF_AUTO] = (int)        $arr[TIFF_AUTO];
       if (isset($arr[OUTPUT_LOG]))      $GLOBALS[OUTPUT_LOG] =             $arr[OUTPUT_LOG];
   }
   }


/**
/**
@@ -948,7 +953,8 @@ EOT;
//        print_r($pids);
//        print_r($pids);
        
        
        if (!$pids && ($cmd != 'stop')) {
        if (!$pids && ($cmd != 'stop')) {
            exec($sript_path . ' > /dev/null 2>&1 &'); // "> /dev/null 2>&1 &" makes sure it is really really run as a background job that does not wait for input
//            exec($sript_path . ' > /dev/null 2>&1 &'); // "> /dev/null 2>&1 &" makes sure it is really really run as a background job that does not wait for input
            exec($sript_path . ' > '.  $GLOBALS[OUTPUT_LOG] .' 2>&1 &'); // "> /dev/null 2>&1 &" makes sure it is really really run as a background job that does not wait for input
            // wait it to run
            // wait it to run
            for ($i = 0; $i < $max_wait; $i ++) {
            for ($i = 0; $i < $max_wait; $i ++) {
                $pids = getPIDByName($sript_name, 'php', $active_only = false);
                $pids = getPIDByName($sript_name, 'php', $active_only = false);