Created
October 28, 2022 13:47
-
-
Save Bestulo/016d8464f70172afe0592147cd50a13b to your computer and use it in GitHub Desktop.
restart capy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Application } from "https://deno.land/x/[email protected]/mod.ts"; | |
const app = new Application(); | |
app.use((ctx) => { | |
// if receive request to /restart?bot=capy, use `pm2 restart capy` | |
if ( | |
ctx.request.url.pathname === "/restart" && | |
ctx.request.url.searchParams.get("bot") === "capy" | |
) { | |
Deno.run({ cmd: ["pm2", "restart", "capy"] }); | |
ctx.response.body = "Restarted capy"; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment