Skip to content

Commit

Permalink
Fix the service status when using systemd (#15)
Browse files Browse the repository at this point in the history
# Summary

When using BDII on Alma 9, the reported GlueServiceStatusInfo value is
`??`, as the code is using service command instead of systemctl.
However, since CentOS 7, systemd is used by default. The following PR
permits to report correctly the value of status:
 ```
$ glite-info-service-status bdii
active
```

Co-authored-by: Baptiste Grenier <[email protected]>
  • Loading branch information
Pansanel and gwarf authored Jan 24, 2025
1 parent 7e5616f commit 0a4994b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion etc/glite-info-service-bdii-site.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ get_endpoint = echo ldap://$BDII_HOST:$BDII_PORT_READ/mds-vo-name=$GLITE_INFO_SE
# The return code should indicate the status:
# 0 = OK, 1 = Critical, 2 = Warning, 3 = Unknown, other = Other

get_status = glite-info-service-test BDII && /sbin/service bdii status
get_status = glite-info-service-test BDII && glite-info-service-status bdii

# The URL of a WSDL document describing the service
# If the string does not start with "http" this will be omitted
Expand Down
2 changes: 1 addition & 1 deletion etc/glite-info-service-bdii-top.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ get_endpoint = echo ldap://$BDII_HOST:$BDII_PORT_READ/mds-vo-name=local,o=grid
# The return code should indicate the status:
# 0 = OK, 1 = Critical, 2 = Warning, 3 = Unknown, other = Other

get_status = glite-info-service-test BDII && /sbin/service bdii status
get_status = glite-info-service-test BDII && glite-info-service-status bdii

# The URL of a WSDL document describing the service
# If the string does not start with "http" this will be omitted
Expand Down
2 changes: 1 addition & 1 deletion etc/glite-info-service-bdii.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ get_endpoint = echo ldap://$BDII_HOST:$BDII_PORT_READ/$BDII_BIND
# The return code should indicate the status:
# 0 = OK, 1 = Critical, 2 = Warning, 3 = Unknown, other = Other

get_status = glite-info-service-test BDII && /sbin/service bdii status
get_status = glite-info-service-test BDII && glite-info-service-status bdii

# The URL of a WSDL document describing the service
# If the string does not start with "http" this will be omitted
Expand Down
2 changes: 1 addition & 1 deletion src/glite-info-service-status
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ shift
export LANG=C

# Collect the stdout and return code from service status
string=$(/sbin/service "$service" status "$@")
string=$(/usr/bin/systemctl is-active "${service}")
rc=$?

# Strip out the standard representation of pids
Expand Down

0 comments on commit 0a4994b

Please sign in to comment.