Minor correction to run in container

This commit is contained in:
2016-07-18 09:37:01 +02:00
parent 83e0e0b86b
commit 0a9e94da01
5 changed files with 19 additions and 18 deletions

2
opt/inverter/create_rrd.php Normal file → Executable file
View File

@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/local/bin/php
<?php
require_once 'rrd.php';

10
opt/inverter/daemon.php Normal file → Executable file
View File

@@ -1,16 +1,14 @@
<?php
require_once 'System/Daemon.php'; // pear install -f System_Daemon
define('NAME', 'inverter');
define('TASK', '/opt/inverter/inverter.pl > /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,6 +24,8 @@ function daemon_init() {
}
function daemon_install() {
global $argv;
System_Daemon::writeAutoRun(); // update-rc.d %s defaults
/* Write scripts for scheduling with at */

11
opt/inverter/inverter.php Normal file → Executable file
View File

@@ -1,16 +1,17 @@
#!/usr/bin/php
#!/usr/local/bin/php
<?php
require_once 'functions.php';
require_once 'daemon.php';
define('NAME', 'inverter');
define('TASK', '/opt/inverter/inverter.pl > /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"));

0
opt/inverter/inverter.pl Normal file → Executable file
View File

4
opt/inverter/pvoutput.php Normal file → Executable file
View File

@@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/local/bin/php
<?php
require_once 'functions.php';
require_once 'rrd.php';
@@ -92,7 +92,7 @@ if (isset($fTemperature)) {
$fTemperature = abs($aToday[3] - $fTemperature) > (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 */