debug
This commit is contained in:
parent
3950ab7d36
commit
af26fd4653
7
moha.php
7
moha.php
@ -59,6 +59,7 @@ if ($testMode)
|
|||||||
$httpServerIp = "127.0.0.1";
|
$httpServerIp = "127.0.0.1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require "/etc/moha/liste_telephones.php";
|
||||||
if (!init()) exit(1);
|
if (!init()) exit(1);
|
||||||
|
|
||||||
|
|
||||||
@ -112,13 +113,17 @@ function logger($level, $log, $pos = "", $device=null, $notif = true)
|
|||||||
|
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
global $logFile, $logFh, $client;
|
global $logFile, $logFh, $client, $presence, $macAddresses;
|
||||||
date_default_timezone_set('Europe/Paris');
|
date_default_timezone_set('Europe/Paris');
|
||||||
if (! $logFh = fopen($logFile, "w") )
|
if (! $logFh = fopen($logFile, "w") )
|
||||||
{
|
{
|
||||||
echo _("error opening log file in ") . getcwd();
|
echo _("error opening log file in ") . getcwd();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
foreach($macAddresses as $key => $value)
|
||||||
|
{
|
||||||
|
$presence[$key] = false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
20
systemd/moha.service
Normal file
20
systemd/moha.service
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=moha
|
||||||
|
After=network.target
|
||||||
|
After=mosquitto.service
|
||||||
|
After=mysqld.service
|
||||||
|
After=pws2mqtt.service
|
||||||
|
After=zigbee2mqtt.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=php /home/daniel/moha/moha.php
|
||||||
|
WorkingDirectory=/home/daniel/moha
|
||||||
|
StandardOutput=inherit
|
||||||
|
StandardError=inherit
|
||||||
|
Restart=always
|
||||||
|
User=domotique
|
||||||
|
roup=domotique
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
Loading…
Reference in New Issue
Block a user