Add an ability to enable/disable nscd (#3652)

This commit is contained in:
Louis Lam 2023-08-28 16:15:48 +08:00 committed by GitHub
parent 0c40f02584
commit cd79df07e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 69 additions and 6 deletions

View file

@ -341,7 +341,11 @@ class UptimeKumaServer {
* @returns {Promise<void>}
*/
async start() {
this.startServices();
let enable = await Settings.get("nscd");
if (enable || enable === null) {
this.startNSCDServices();
}
}
/**
@ -349,14 +353,18 @@ class UptimeKumaServer {
* @returns {Promise<void>}
*/
async stop() {
this.stopServices();
let enable = await Settings.get("nscd");
if (enable || enable === null) {
this.stopNSCDServices();
}
}
/**
* Start all system services (e.g. nscd)
* For now, only used in Docker
*/
startServices() {
startNSCDServices() {
if (process.env.UPTIME_KUMA_IS_CONTAINER) {
try {
log.info("services", "Starting nscd");
@ -370,7 +378,7 @@ class UptimeKumaServer {
/**
* Stop all system services
*/
stopServices() {
stopNSCDServices() {
if (process.env.UPTIME_KUMA_IS_CONTAINER) {
try {
log.info("services", "Stopping nscd");