mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 23:04:04 +00:00
WIP
This commit is contained in:
parent
80d5f6840b
commit
642136780f
3 changed files with 74 additions and 1 deletions
59
extra/cli.js
59
extra/cli.js
|
@ -1,5 +1,8 @@
|
|||
#!/usr/bin/env node
|
||||
const path = require("path");
|
||||
const args = require("args-parser")(process.argv);
|
||||
|
||||
// Set the data directory
|
||||
if (!process.env.DATA_DIR) {
|
||||
if (process.platform === "win32") {
|
||||
process.env.DATA_DIR = process.env.LOCALAPPDATA + "\\uptime-kuma\\";
|
||||
|
@ -15,4 +18,58 @@ if (!process.env.DATA_DIR) {
|
|||
}
|
||||
}
|
||||
|
||||
require("../server/server");
|
||||
// Change the working directory to the root of the project, so it can read the dist folder
|
||||
process.chdir(path.join(__dirname, ".."));
|
||||
|
||||
if (args.run) {
|
||||
require("../server/server");
|
||||
|
||||
} else if (args.installService) {
|
||||
|
||||
if (process.platform === "win32") {
|
||||
let Service = require("node-windows").Service;
|
||||
|
||||
// Create a new service object
|
||||
let svc = new Service({
|
||||
name: "Uptime Kuma",
|
||||
description: "Uptime Kuma is an easy-to-use self-hosted monitoring tool.",
|
||||
script: "C:\\path\\to\\helloworld.js",
|
||||
nodeOptions: [
|
||||
"--harmony",
|
||||
"--max_old_space_size=4096"
|
||||
]
|
||||
//, workingDirectory: '...'
|
||||
//, allowServiceLogon: true
|
||||
});
|
||||
|
||||
// Listen for the "install" event, which indicates the
|
||||
// process is available as a service.
|
||||
svc.on("install", function () {
|
||||
svc.start();
|
||||
});
|
||||
|
||||
svc.install();
|
||||
} else if (process.platform === "linux") {
|
||||
|
||||
} else {
|
||||
console.error("Unable to install service on platform: " + process.platform);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
} else if (args.version || args.v) {
|
||||
const version = require("../package.json").version;
|
||||
console.log("Uptime Kuma version: " + version);
|
||||
|
||||
} else {
|
||||
console.log(`Usage: uptime-kuma [options]
|
||||
|
||||
Options:
|
||||
--install-service Install Uptime Kuma service (Windows and Linux only)
|
||||
--uninstall-service Uninstall Uptime Kuma service
|
||||
--run Run Uptime Kuma directly in the terminal
|
||||
--data-dir="your path" Set the data directory
|
||||
--version Print the version
|
||||
--help Print this help
|
||||
`);
|
||||
}
|
||||
|
||||
|
|
15
package-lock.json
generated
15
package-lock.json
generated
|
@ -53,6 +53,7 @@
|
|||
"nanoid": "~3.3.4",
|
||||
"node-cloudflared-tunnel": "~1.0.9",
|
||||
"node-radius-client": "~1.0.0",
|
||||
"node-windows": "^1.0.0-beta.8",
|
||||
"nodemailer": "~6.6.5",
|
||||
"nostr-tools": "^1.13.1",
|
||||
"notp": "~2.0.3",
|
||||
|
@ -14645,6 +14646,15 @@
|
|||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/node-windows": {
|
||||
"version": "1.0.0-beta.8",
|
||||
"resolved": "https://registry.npmjs.org/node-windows/-/node-windows-1.0.0-beta.8.tgz",
|
||||
"integrity": "sha512-uLekXnSeem3nW5escID224Fd0U/1VtvE796JpSpOY+c73Cslz/Qn2WUHRJyPQJEMrNGAy/FMRFjjhh4z1alZTA==",
|
||||
"dependencies": {
|
||||
"xml": "1.0.1",
|
||||
"yargs": "^17.5.1"
|
||||
}
|
||||
},
|
||||
"node_modules/nodemailer": {
|
||||
"version": "6.6.5",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.6.5.tgz",
|
||||
|
@ -19019,6 +19029,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/xml": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
|
||||
"integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw=="
|
||||
},
|
||||
"node_modules/xmlbuilder": {
|
||||
"version": "8.2.2",
|
||||
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-8.2.2.tgz",
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
"nanoid": "~3.3.4",
|
||||
"node-cloudflared-tunnel": "~1.0.9",
|
||||
"node-radius-client": "~1.0.0",
|
||||
"node-windows": "^1.0.0-beta.8",
|
||||
"nodemailer": "~6.6.5",
|
||||
"nostr-tools": "^1.13.1",
|
||||
"notp": "~2.0.3",
|
||||
|
|
Loading…
Reference in a new issue