Skip to content

Commit 92d8c2f

Browse files
committed
introduce status-as option to check-ntservice
1 parent 85b1d8b commit 92d8c2f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

check-ntservice/lib/check_ntservice.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var opts struct {
1414
ExcludeService string `long:"exclude-service" short:"x" description:"exclude if contained in service name. This option takes precedence over --service-name."`
1515
ListService bool `long:"list-service" short:"l" description:"list service"`
1616
Exact bool `long:"exact" description:"more exact checking of the service. This option applies only to --service-name."`
17+
StatusAs string `long:"status-as" description:"Overwrite status=to-status, support multiple comma separates."`
1718
}
1819

1920
// Win32Service is struct for Win32_Service.
@@ -27,7 +28,12 @@ type Win32Service struct {
2728
func Do() {
2829
ckr := run(os.Args[1:])
2930
ckr.Name = "NtService"
30-
ckr.Exit()
31+
maps, err := checkers.ParseStatusMap(opts.StatusAs)
32+
if err != nil {
33+
fmt.Println(err)
34+
os.Exit(1)
35+
}
36+
ckr.ExitStatusAs(maps)
3137
}
3238

3339
var getServiceStateFunc = getServiceState

0 commit comments

Comments
 (0)