From 0a9e94da016b3661dc3c9061bc97141c63810ed7 Mon Sep 17 00:00:00 2001 From: Rik Veenboer Date: Mon, 18 Jul 2016 09:37:01 +0200 Subject: [PATCH] Minor correction to run in container --- opt/inverter/create_rrd.php | 4 ++-- opt/inverter/daemon.php | 14 +++++++------- opt/inverter/inverter.php | 13 +++++++------ opt/inverter/inverter.pl | 0 opt/inverter/pvoutput.php | 6 +++--- 5 files changed, 19 insertions(+), 18 deletions(-) mode change 100644 => 100755 opt/inverter/create_rrd.php mode change 100644 => 100755 opt/inverter/daemon.php mode change 100644 => 100755 opt/inverter/inverter.php mode change 100644 => 100755 opt/inverter/inverter.pl mode change 100644 => 100755 opt/inverter/pvoutput.php diff --git a/opt/inverter/create_rrd.php b/opt/inverter/create_rrd.php old mode 100644 new mode 100755 index 8dcf172..a2fc76c --- a/opt/inverter/create_rrd.php +++ b/opt/inverter/create_rrd.php @@ -1,4 +1,4 @@ -#!/usr/bin/php +#!/usr/local/bin/php /dev/null'); +define('CWD', '/opt/inverter/'); define('FILE_DAEMON_START', 'daemon_start.sh'); define('FILE_DAEMON_STOP', 'daemon_stop.sh'); define('MODE', 0755); define('PROCESS_POLL', 30); -/* Install daemon */ -if (isset($argv[1]) && $argv[1] == 'install') { - daemon_install(); -} - function daemon_init() { global $sName; @@ -26,8 +24,10 @@ function daemon_init() { } function daemon_install() { + global $argv; + System_Daemon::writeAutoRun(); // update-rc.d %s defaults - + /* Write scripts for scheduling with at */ if (isset($argv[2]) && $argv[2] == 'schedule') { if (!file_exists(FILE_DAEMON_START)) { @@ -65,4 +65,4 @@ function daemon_sigterm_handler($iSigNo) { global $sName; system(sprintf('pkill %s', $sName)); System_Daemon::stop(); -} \ No newline at end of file +} diff --git a/opt/inverter/inverter.php b/opt/inverter/inverter.php old mode 100644 new mode 100755 index 729f7ce..b8b3a1a --- a/opt/inverter/inverter.php +++ b/opt/inverter/inverter.php @@ -1,16 +1,17 @@ -#!/usr/bin/php +#!/usr/local/bin/php /dev/null'); -define('CWD', '/opt/inverter/'); - /* Initialize */ chdir(CWD); daemon_init(); +/* Install daemon */ +if (isset($argv[1]) && $argv[1] == 'install') { + daemon_install(); +} + /* Remove previous at entries */ foreach (explode("\n", trim(command('atq 2> /dev/null'))) as $sJob) { $sId = substr($sJob, 0, strpos($sJob, "\t")); @@ -54,4 +55,4 @@ function schedule_sleep() { $sTime = date('H:i', strtotime($sSleep)); System_Daemon::info(sprintf('Schedule sleep at %s', $sTime)); command(sprintf('at -f %s %s 2> /dev/null', FILE_DAEMON_STOP, $sTime)); -} \ No newline at end of file +} diff --git a/opt/inverter/inverter.pl b/opt/inverter/inverter.pl old mode 100644 new mode 100755 diff --git a/opt/inverter/pvoutput.php b/opt/inverter/pvoutput.php old mode 100644 new mode 100755 index b297a05..458f4d4 --- a/opt/inverter/pvoutput.php +++ b/opt/inverter/pvoutput.php @@ -1,4 +1,4 @@ -#!/usr/bin/php +#!/usr/local/bin/php (MARGIN_TEMPERATURE * $aToday[3]) ? $aToday[3] : $fTemperature; } $aData['v5'] = $fTemperature; // ignore potential flaws in first temperature of the day - file_put_contents('temp.csv', sprintf("%d,%f\n", $iTime,$fTemperature), FILE_APPEND); + file_put_contents('temp.csv', sprintf("%d,%f\n", $iTime, $fTemperature), FILE_APPEND); } /* Store debug data */ @@ -109,4 +109,4 @@ if (isset($aSystems[$sSerial])) { CURLOPT_POSTFIELDS => http_build_query($aData), CURLOPT_RETURNTRANSFER => true)); $sResult = curl_exec($rCurl); -} \ No newline at end of file +}