aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-05-26 09:43:42 +0200
committerMinteck <contact@minteck.org>2022-05-26 09:43:42 +0200
commit006aaff302a0e4027f7daff5f5fa732b2dae686e (patch)
treecc03f20661d2b4515a5721f13a04c5f960303629
parent6d06d9a96bb089254aa89dae0ae49f73c8d8bfe4 (diff)
downloadvaportrail-006aaff302a0e4027f7daff5f5fa732b2dae686e.tar.gz
vaportrail-006aaff302a0e4027f7daff5f5fa732b2dae686e.tar.bz2
vaportrail-006aaff302a0e4027f7daff5f5fa732b2dae686e.zip
Prepare implementing CI
-rw-r--r--index.js12
-rwxr-xr-xvaportrail13
2 files changed, 25 insertions, 0 deletions
diff --git a/index.js b/index.js
index 78c9a11..7c54827 100644
--- a/index.js
+++ b/index.js
@@ -25,9 +25,21 @@
// noinspection JSUnresolvedVariable,HttpUrlsUsage
+// Imports and stuff
const express = require('express');
+const fs = require('fs');
const app = express();
+// Restart manager
+async function restartManager() {
+ if (fs.existsSync("./RESTART")) {
+ fs.rmSync("./RESTART", { recursive: true });
+ console.log("Restart requested.");
+ process.exit(14);
+ }
+}
+setInterval(restartManager, 500)
+
// Public pages
app.get('/', (req, res) => {
res.render("index");
diff --git a/vaportrail b/vaportrail
new file mode 100755
index 0000000..2cd2792
--- /dev/null
+++ b/vaportrail
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+if ! command -v node &> /dev/null
+then
+ echo "'node' not found in PATH, please install NodeJS."
+ exit
+fi
+x_run () {
+ node index.js
+ if [[ $? -eq 14 ]]; then
+ x_run
+ fi
+}
+x_run \ No newline at end of file