pull/243/merge
Fabian Franz BSc 1 year ago committed by GitHub
commit eea0e854ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -27,6 +27,7 @@
#include "ccontroller.h" #include "ccontroller.h"
#include "cvocodecs.h" #include "cvocodecs.h"
#include "cambeserver.h" #include "cambeserver.h"
#include <systemd/sd-daemon.h>
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
@ -81,6 +82,7 @@ bool CAmbeServer::Start(void)
{ {
// //
m_pThread = new std::thread(CAmbeServer::Thread, this); m_pThread = new std::thread(CAmbeServer::Thread, this);
sd_notify(0, "READY=1");
} }
// done // done

@ -25,6 +25,7 @@
#include "main.h" #include "main.h"
#include <string.h> #include <string.h>
#include "cvocodecs.h" #include "cvocodecs.h"
#include <systemd/sd-daemon.h>
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// global object // global object
@ -243,10 +244,12 @@ bool CVocodecs::Init(void)
if ( ok ) if ( ok )
{ {
std::cout << "Codec interfaces initialized successfully : " << iNbCh << " channels available" << std::endl; std::cout << "Codec interfaces initialized successfully : " << iNbCh << " channels available" << std::endl;
sd_notifyf(0, "STATUS=Codec interfaces initialized successfully : %i channels available", iNbCh);
} }
else else
{ {
std::cout << "At least one codec interfaces failed to initialize : " << iNbCh << " channels availables" << std::endl; std::cout << "At least one codec interfaces failed to initialize : " << iNbCh << " channels availables" << std::endl;
sd_notifyf(0, "STATUS=At least one codec interfaces failed to initialize : %i channels availables", iNbCh);
} }
// done // done
return ok; return ok;

@ -8,7 +8,8 @@ EXECUTABLE=ambed
all: $(SOURCES) $(EXECUTABLE) all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS) $(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -lftd2xx -Wl,-rpath,/usr/local/lib -o $@ $(CC) $(LDFLAGS) $(OBJECTS) -lftd2xx -Wl,-rpath,/usr/local/lib -lsystemd -o $@
.cpp.o: .cpp.o:
$(CC) $(CFLAGS) $< -o $@ $(CC) $(CFLAGS) $< -o $@

@ -109,6 +109,18 @@ class xReflector {
else { else {
$this->ProcessIDFile = null; $this->ProcessIDFile = null;
$this->ServiceUptime = null; $this->ServiceUptime = null;
exec('/usr/bin/systemctl show --property=ActiveEnterTimestamp xlxd.service', $out, $code);
if ($code == 0) {
if (is_array($out) && count($out) > 0) {
$out = $out[0];
}
if (is_string($out)) {
$out = explode('=', $out, 2)[1];
$out = strtotime($out);
$this->ServiceUptime = time() - $out;
}
}
} }
} }

@ -1,9 +1,10 @@
[Unit] [Unit]
Description=AMBE Transcoder Daemon Description=AMBE Transcoder Daemon
After=network.target After=network.target
Requires=network-online.target
[Service] [Service]
Type=simple Type=notify
User=root User=root
Group=root Group=root
ExecStartPre=-/sbin/rmmod ftdi_sio ExecStartPre=-/sbin/rmmod ftdi_sio

@ -0,0 +1,5 @@
#!/bin/sh
if journalctl -u ambed.service --since "5min ago" --grep 'Device .* is unresponsive'; then
systemctl restart ambed.service
systemctl restart xlxd.service
fi

@ -0,0 +1,7 @@
[Unit]
Description=Check ambedwatchdog
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/ambedwatchdog

@ -0,0 +1,10 @@
[Unit]
Description=Contiously monitor ambed if it crashes
Requires=xlxd.service ambed.service
[Timer]
OnCalendar=*-*-* *:*:0/5
Unit=ambedwatchdog.service
[Install]
WantedBy=multi-user.target

@ -0,0 +1,3 @@
#!/bin/bash
/usr/bin/wget -q -O- http://localhost/index.php?callhome=1 > /dev/null

@ -0,0 +1,9 @@
[Unit]
Description=XLX API Service
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/xlxapi-update

@ -0,0 +1,9 @@
[Unit]
Description=Run xlx api call every day (if nobody opens the dashboard)
[Timer]
OnCalendar=*-*-* 1:0:0
Unit=xlxapi-update.service
[Install]
WantedBy=multi-user.target

@ -0,0 +1,16 @@
[Unit]
Description=XLX Reflector (XLX999)
After=network.target ambed.service
Requires=network-online.target
[Service]
Type=notify
User=xlxd
Group=xlxd
AmbientCapabilities=CAP_NET_RAW
ExecStart=/xlxd/xlxd XLX999 1.2.3.4 127.0.0.1
Restart=on-abnormal
RestartSec=30
[Install]
WantedBy=multi-user.target

@ -31,6 +31,7 @@
#include "ctranscoder.h" #include "ctranscoder.h"
#include "cysfnodedirfile.h" #include "cysfnodedirfile.h"
#include "cysfnodedirhttp.h" #include "cysfnodedirhttp.h"
#include <systemd/sd-daemon.h>
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// constructor // constructor
@ -132,6 +133,7 @@ bool CReflector::Start(void)
#ifdef JSON_MONITOR #ifdef JSON_MONITOR
m_JsonReportThread = new std::thread(CReflector::JsonReportThread, this); m_JsonReportThread = new std::thread(CReflector::JsonReportThread, this);
#endif #endif
sd_notify(0, "READY=1");
} }
else else
{ {

@ -1,6 +1,6 @@
CC=g++ CC=g++
CFLAGS=-c -std=c++11 -pthread CFLAGS=-c -std=c++11 -pthread
LDFLAGS=-std=c++11 -pthread LDFLAGS=-std=c++11 -pthread -lsystemd
SOURCES=$(wildcard *.cpp) SOURCES=$(wildcard *.cpp)
OBJECTS=$(SOURCES:.cpp=.o) OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=xlxd EXECUTABLE=xlxd

Loading…
Cancel
Save

Powered by TurnKey Linux.