From 006aaff302a0e4027f7daff5f5fa732b2dae686e Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 26 May 2022 09:43:42 +0200 Subject: Prepare implementing CI --- index.js | 12 ++++++++++++ vaportrail | 13 +++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 vaportrail 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 -- cgit