From c43559caedd492590b19d7bb3c02862208f7e96d Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Mon, 17 Apr 2023 15:22:39 +0700 Subject: [PATCH] update wb-rule --- files/vestasync.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/files/vestasync.js b/files/vestasync.js index cb8fe9f..3ef8366 100644 --- a/files/vestasync.js +++ b/files/vestasync.js @@ -60,15 +60,11 @@ function _update_vestasync() { } }); - runShellCommand("systemctl is-enabled pushgit_inotify.service", { + runShellCommand("systemctl is-active pushgit_inotify.service", { captureOutput: true, exitCallback: function (exitCode, capturedOutput) { - if (exitCode === 0) { - var isEnabled = capturedOutput.trim() === "enabled"; - dev.vestasync.autopush = isEnabled; - } else { - log("Error checking autopush status:" + capturedOutput + exitCode); - } + var isEnabled = capturedOutput.trim() === "active"; + dev.vestasync.autopush = isEnabled; } }); @@ -91,15 +87,15 @@ defineRule("_vestasync_autopush", { whenChanged: "vestasync/autopush", then: function (newValue, devName, cellName) { if (dev.vestasync.autopush) { - runShellCommand("systemctl start pushgit_inotify.service"); + runShellCommand("systemctl daemon-reload ; systemctl enable pushgit_inotify.service ; systemctl start pushgit_inotify.service"); } else { - runShellCommand("systemctl stop pushgit_inotify.service"); + runShellCommand("systemctl stop pushgit_inotify.service ; systemctl disable pushgit_inotify.service"); } } }); _update_vestasync(); -setInterval(_update_vestasync, 10000); +setInterval(_update_vestasync, 11000);