Create an update script and add an update command to the main process.
This commit is contained in:
parent
ca4282c02f
commit
64adc6cc86
5
index.js
5
index.js
|
@ -3,6 +3,7 @@
|
||||||
const restify = require('restify')
|
const restify = require('restify')
|
||||||
const log = require('./lib/log')('main')
|
const log = require('./lib/log')('main')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
const { exec } = require('child_process')
|
||||||
|
|
||||||
const BLE = require('./lib/ble')
|
const BLE = require('./lib/ble')
|
||||||
const intval = require('./lib/intval')
|
const intval = require('./lib/intval')
|
||||||
|
@ -519,6 +520,10 @@ function seq () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update (req, res, next) {
|
||||||
|
exec('sh ./scripts/update.sh')
|
||||||
|
}
|
||||||
|
|
||||||
function index (req, res, next) {
|
function index (req, res, next) {
|
||||||
fs.readFile(INDEXPATH, 'utf8', (err, data) => {
|
fs.readFile(INDEXPATH, 'utf8', (err, data) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd /home/pi/intval3
|
||||||
|
|
||||||
|
sudo -u pi -i<< EOF
|
||||||
|
git pull
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo pm2 restart process.json
|
Loading…
Reference in New Issue