Skip to content

Commit

Permalink
Added machine params nachlaufzeit & watchdog
Browse files Browse the repository at this point in the history
  • Loading branch information
cprezzi committed Nov 11, 2019
1 parent f8f3803 commit 81bad95
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 3 deletions.
15 changes: 15 additions & 0 deletions access_auth_server.conf
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions api/controllers/aasController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions service_starten.txt
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 6 additions & 0 deletions views/machine_edit.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions views/machines.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'

0 comments on commit 81bad95

Please sign in to comment.