From fb1bb8af89c658c4621434979ae83fcf3f465152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?youngchief=20btw=20=E3=83=84?= <33383463+youngchief-btw@users.noreply.github.com> Date: Wed, 9 Dec 2020 15:57:36 -0800 Subject: [PATCH] Add self-updating to the code! --- src/ProxyChief.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/ProxyChief.js b/src/ProxyChief.js index 2e361f4..0a9278b 100644 --- a/src/ProxyChief.js +++ b/src/ProxyChief.js @@ -11,6 +11,7 @@ const express = require("express"); const app = express(); const httpProxy = require("http-proxy"); // var proxy = httpProxy.createProxyServer({}); +const { exec } = require("child_process"); function miniCPU() { // This function lowers memory, disk, and CPU on request @@ -32,3 +33,18 @@ app.get("/", function(req, res) { }); app.listen(process.env.PORT); + +setInterval(function() { + // Self-updating + exec("git pull && git fetch", (error, stdout, stderr) => { + if (error) { + console.log(`${error.message}`); + return; + } + if (stderr) { + console.log(`${stderr}`); + return; + } + console.log(`${stdout}`); + }); +}, 60000)