Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-3513

services promises using standrd_services are not able to reliably get the current status

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Done
    • Priority: (None)
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.12.7, 3.15.4, 3.18.0
    • Component/s: None
    • Labels:
      None

      Description

      From: https://github.com/cfengine/masterfiles/pull/1876

      If a service is not enabled in rc.conf on FreeBSD, trying to get the status always results in something like:

      # /etc/rc.d/ntpd status
      Cannot 'status' ntpd. Set ntpd_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'.
      # echo $?
      0
      

      As the exit code is zero, cf-agent would try to stop this service. Using onestatus always returns the wanted exit code, regardless if the service is enabled or not.

      # /etc/rc.d/ntpd onestatus
      ntpd is not running.
      # echo $?
      1
      

        Attachments

          Activity

            People

            • Assignee:
              a10042 Nick Anderson
              Reporter:
              a10042 Nick Anderson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel