Commit 054ec863 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

fixed

parent 0fe31330
...@@ -38,14 +38,14 @@ ...@@ -38,14 +38,14 @@
*! *!
*/ */
include 'show_source.inc'; include 'include/show_source_include.php';
//default parameters //default parameters
$cmd = "start"; $cmd = "start";
$file = "/usr/html/CF/imu_log.log"; $file = "/mnt/sda1/imu_log.log";
$index = 1; $index = 1;
$n = 5000000; $n = 5000000;
$mount_point = "/usr/html/CF"; $mount_point = "/mnt/sda1";
$force_dev = false; $force_dev = false;
...@@ -65,18 +65,16 @@ if (isset($_GET['dev'])) { ...@@ -65,18 +65,16 @@ if (isset($_GET['dev'])) {
} }
if ($cmd=="start") { if ($cmd=="start") {
if (!is_dir($mount_point)) mkdir($mount_point); if (!is_dir($mount_point)) mkdir($mount_point);
//detect devices //detect devices
//$dev = "/dev/hda1"; //$dev = "/dev/hda1";
if (!$force_dev) { if (!$force_dev) {
$hda1 = exec("cat /proc/diskstats | grep 'hda1'"); $sda1 = exec("cat /proc/diskstats | grep 'sda1'");
$hdb1 = exec("cat /proc/diskstats | grep 'hdb1'");
if (strlen($hda1)>0) $dev = "/dev/hda1"; if (strlen($sda1)>0) $dev = "/dev/sda1";
else if (strlen($hdb1)>0) $dev = "/dev/hdb1";
else { else {
$xml .= "\t<error>CF cards not found</error>\n"; $xml .= "\t<error>CF cards not found</error>\n";
send_response($xml); send_response($xml);
...@@ -84,7 +82,7 @@ if ($cmd=="start") { ...@@ -84,7 +82,7 @@ if ($cmd=="start") {
} }
exec("mount $dev $mount_point"); exec("mount $dev $mount_point");
exec("/usr/local/bin/log_imu $file $index $n >/dev/null 2>&1 &"); exec("/usr/bin/log_imu $file $index $n >/dev/null 2>&1 &");
$xml .= "\t<result>ok</result>\n"; $xml .= "\t<result>ok</result>\n";
} }
...@@ -112,11 +110,11 @@ function send_response($xml){ ...@@ -112,11 +110,11 @@ function send_response($xml){
function _help(){ function _help(){
echo "<pre>\n"; echo "<pre>\n";
echo "Usage example: 'http://192.168.0.9/logger_launcher.php?file=/usr/html/CF/test.log&index=1&n=1000000&dev=/dev/hdb1', where\n"; echo "Usage example: 'http://192.168.0.9/logger_launcher.php?file=/mnt/sda1/test.log&index=1&n=1000000&dev=/dev/sda1', where\n";
echo "'file'- log name (includes absolute path), '/usr/html/CF/' is the 'dev's mount point\n"; echo "'file'- log name (includes absolute path), '/usr/html/CF/' is the 'dev's mount point\n";
echo "'index'- index added to the log name\n"; echo "'index'- index added to the log name\n";
echo "'n'- max number of records in a single log file\n"; echo "'n'- max number of records in a single log file\n";
echo "'dev'- device name: '/dev/hda1' or '/dev/hdb1'\n"; echo "'dev'- device name: '/dev/sda1'\n";
} }
function _usage(){ function _usage(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment