mirror of
https://github.com/sebseb7/pilivestreamingtools.git
synced 2025-12-12 13:42:28 +00:00
status web
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
sudo npm i -g pm2
|
||||
sudo pm2 startup
|
||||
sudo pm2 startup
|
||||
npm i express
|
||||
sudo pm2 start status.js
|
||||
24
status.js
Normal file
24
status.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
const { exec } = require('child_process');
|
||||
|
||||
var status = '';
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send('<html><head><title>RPI Speedify Status</title><link rel="icon" href="data:;base64,iVBORw0KGgo="/></head><body>'+status+'</body></html>');
|
||||
});
|
||||
|
||||
|
||||
setInterval(function(){
|
||||
|
||||
exec('/usr/share/speedify/speedify_cli show adapters', (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
status = stdout;
|
||||
});
|
||||
|
||||
},5000);
|
||||
|
||||
app.listen(80);
|
||||
|
||||
Reference in New Issue
Block a user