Skip to content

Commit e6d3bbe

Browse files
committed
clients/upssched.c: let UPSNAME@localhost specs copied from upsmon config "just work" [networkupstools#1858]
1 parent d361816 commit e6d3bbe

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

NEWS

+4
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ https://github.com/networkupstools/nut/milestone/8
243243
- Clarified documentation in codebase according to end-user feedback [#1721,
244244
#1750 and others over time]
245245

246+
- upssched: let `UPSNAME@localhost` specification strings copied from
247+
upsmon config "just work" (previously only exact UPSNAME matches were
248+
supported) [#1858]
249+
246250
- Several fixes for `upsmon` behavior [#1761, #1680...], including new
247251
ability to configure default POWERDOWNFLAG location -- packagers are
248252
encouraged to pick optimal location for their distributions (which

clients/upssched.c

+7
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,13 @@ static int conf_arg(size_t numargs, char **arg)
12641264
/* AT <notifytype> <upsname> <command> <cmdarg1> [<cmdarg2>] */
12651265
if (!strcmp(arg[0], "AT")) {
12661266

1267+
if (str_ends_with(arg[2], "@localhost")) {
1268+
/* Truncate: */
1269+
arg[2][strlen(arg[2]) - strlen("@localhost")] = '\0';
1270+
/* Make a little noise, but do not trash syslog about this: */
1271+
upsdebugx(1, "WARNING: The @localhost in UPS identifier is redundant for upssched");
1272+
}
1273+
12671274
/* don't use arg[5] unless we have it... */
12681275
if (numargs > 5)
12691276
parse_at(arg[1], arg[2], arg[3], arg[4], arg[5]);

0 commit comments

Comments
 (0)