From 82f1a9474d85f75291d0af0e51d55fa904d42055 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 19 Jul 2005 09:30:53 +0000 Subject: r8590: added server status utility functions for checking on the status of a task via irpc - for stream tasks, returns the number of connections - for non-stream tasks, returns "RUNNING" For both, return "DISABLED" or "NOT RESPONDING" appropriately (This used to be commit 78d6303814382f7835212f5045f12180e396b540) --- source4/scripting/libjs/base.js | 11 ++++++ source4/scripting/libjs/management.js | 69 +++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/source4/scripting/libjs/base.js b/source4/scripting/libjs/base.js index 181b3ca959..39b62b133e 100644 --- a/source4/scripting/libjs/base.js +++ b/source4/scripting/libjs/base.js @@ -87,3 +87,14 @@ function substitute_var(str, subobj) } return join("", list); } + +/* + return "s" if a number should be shown as plural +*/ +function plural(n) +{ + if (n == 1) { + return ""; + } + return "s"; +} diff --git a/source4/scripting/libjs/management.js b/source4/scripting/libjs/management.js index 8b04247248..7130cdc5dd 100644 --- a/source4/scripting/libjs/management.js +++ b/source4/scripting/libjs/management.js @@ -91,3 +91,72 @@ function nbtd_statistics() } return io.results[0].info.stats; } + +/* + see if a service is enabled +*/ +function service_enabled(name) +{ + var services = lpGet("server services"); + var i; + for (i=0;i