From 81bad950d99b3fbbfa91a5f67a96c1686bc807a4 Mon Sep 17 00:00:00 2001 From: cprezzi Date: Mon, 11 Nov 2019 17:31:36 +0100 Subject: [PATCH] Added machine params nachlaufzeit & watchdog --- access_auth_server.conf | 15 +++++++++++++++ api/controllers/aasController.js | 6 +++--- service_starten.txt | 8 ++++++++ views/machine_edit.pug | 6 ++++++ views/machines.pug | 4 ++++ 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 access_auth_server.conf create mode 100644 service_starten.txt diff --git a/access_auth_server.conf b/access_auth_server.conf new file mode 100644 index 0000000..f240f8a --- /dev/null +++ b/access_auth_server.conf @@ -0,0 +1,15 @@ +# To autostart the InfoDisplay on Synology NAS, you need to copy this file to /etc/init + +# only start this service after the httpd user process has started +#start on syno.network.ready +start on runlevel 2 + +# stop the service gracefully if the runlevel changes to 'reboot' +stop on runlevel [06] + +# run the scripts as the 'admin' user. Running as root (the default) is a bad idea. +setuid admin + +# exec the process. Use fully formed path names so that there is no reliance on $PATH +# the 'www' file is a node.js script which starts the foobar application. +exec /usr/bin/node /var/services/web/access_auth_server diff --git a/api/controllers/aasController.js b/api/controllers/aasController.js index a348bf9..eb045e7 100644 --- a/api/controllers/aasController.js +++ b/api/controllers/aasController.js @@ -239,7 +239,7 @@ exports.machines = function(req, res) { //console.log('connected as id ' + connection.threadId); var machines = Array(); - connection.query('SELECT mid, m.name, config, price, period, u.name units, min_periods FROM machines m LEFT JOIN price_units u ON m.uid=u.uid', function(error, rows, fields) { + connection.query('SELECT mid, m.name, config, price, period, u.name units, min_periods, nachlauf, watchdog FROM machines m LEFT JOIN price_units u ON m.uid=u.uid', function(error, rows, fields) { if (error) { res.send(error); } else { @@ -939,7 +939,7 @@ exports.machine_edit = function(req, res) { } //console.log('connected as id ' + connection.threadId); - connection.query('UPDATE machines SET name=?, config=?, price=?, period=?, uid=?, min_periods=? WHERE mid=?', [req.body.name, req.body.config, req.body.price, req.body.period, req.body.uid, req.body.min_periods, req.query.mid], function(error, result) { + connection.query('UPDATE machines SET name=?, config=?, price=?, period=?, uid=?, min_periods=?, nachlauf=?, watchdog=? WHERE mid=?', [req.body.name, req.body.config, req.body.price, req.body.period, req.body.uid, req.body.min_periods, req.body.nachlauf, req.body.watchdog, req.query.mid], function(error, result) { if (error) { res.send(error); } else { @@ -963,7 +963,7 @@ exports.machine_edit = function(req, res) { } //console.log('connected as id ' + connection.threadId); - connection.query('INSERT machines SET name=?, config=?, price=?, period=?, uid=?, min_periods=?', [req.body.name, req.body.config, req.body.price, req.body.period, req.body.uid, req.body.min_periods], function(error, result) { + connection.query('INSERT machines SET name=?, config=?, price=?, period=?, uid=?, min_periods=?, nachlauf=?, watchdog=?', [req.body.name, req.body.config, req.body.price, req.body.period, req.body.uid, req.body.min_periods, req.body.nachlauf, req.body.watchdog], function(error, result) { connection.release(); if (error) { res.send(error); diff --git a/service_starten.txt b/service_starten.txt new file mode 100644 index 0000000..6a566f6 --- /dev/null +++ b/service_starten.txt @@ -0,0 +1,8 @@ +Zum Starten und Stoppen des Access Auth Servers gibt es unter /usr/local/etc/rc.d/ das script access_auth_server.sh. + +Start: sudo ./access_auth_server.sh start +Stop: sudo ./access_auth_server.sh stop +Restart: sudo ./access_auth_server.sh restart +Status: sudo ./access_auth_server.sh status + +Dieses Script sorgt auch dafür, dass der Server beim Booten gestartet wird. \ No newline at end of file diff --git a/views/machine_edit.pug b/views/machine_edit.pug index 28a05e8..cbc7f64 100644 --- a/views/machine_edit.pug +++ b/views/machine_edit.pug @@ -30,5 +30,11 @@ block content div.form-group label(for='min_periods') Min. Periods: input#min_periods.form-control(type='text', name='min_periods' value=(undefined===machine ? '' : machine.min_periods)) + div.form-group + label(for='nachlauf') Nachlauf: + input#nachlauf.form-control(type='text', name='nachlauf' value=(undefined===machine ? '' : machine.nachlauf)) + div.form-group + label(for='watchdog') Watchdog: + input#watchdog.form-control(type='text', name='watchdog' value=(undefined===machine ? '' : machine.watchdog)) div.form-group button.btn.btn-primary(type='submit') Save diff --git a/views/machines.pug b/views/machines.pug index 5aaeb92..178c467 100644 --- a/views/machines.pug +++ b/views/machines.pug @@ -13,6 +13,8 @@ block content th Period th Units th Min. Periods + th Nachlauf + th Watchdog th a(href='/machine_edit')= 'Add' each machine in machines @@ -24,6 +26,8 @@ block content td #{machine.period} td #{machine.units} td #{machine.min_periods} + td #{machine.nachlauf} + td #{machine.watchdog} td a(href='/machine_edit?mid=' + machine.mid)= 'Edit' \ No newline at end of file