Sha256: 8b0847e1ffb5b1551586791c9e68e37c161602f6ef820db9e22b7f61ab62cd05

Contents?: true

Size: 1.5 KB

Versions: 5

Compression:

Stored size: 1.5 KB

Contents

---
title: About the launchd_service Resource
platform: linux
---

# launchd_service

Use the ``launchd_service`` InSpec audit resource to test a service using Launchd.

<br>

## Syntax

A ``launchd_service`` resource block declares the name of a service and then one (or more) matchers to test the state of the service:

    describe launchd_service('service_name') do
      it { should be_installed }
      it { should be_enabled }
      it { should be_running }
    end

where

* ``('service_name')`` must specify a service name
* `be_installed`, `be_enabled`, and `be_running` are valid matchers for this resource; all matchers available to the `service` resource may be used

The path to the service manager's control may be specified for situations where the path isn't available in the current ``PATH``. For example:

    describe launchd_service('service_name', '/path/to/control') do
      it { should be_enabled }
      it { should be_installed }
      it { should be_running }
    end

<br>

## Matchers

For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).

### be_enabled

The `be_enabled` matcher tests if the named service is enabled:

    it { should be_enabled }

### be_installed

The `be_installed` matcher tests if the named service is installed:

    it { should be_installed }

### be_running

The `be_running` matcher tests if the named service is running:

    it { should be_running }

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
inspec-2.1.81 docs/resources/launchd_service.md.erb
inspec-2.1.21 docs/resources/launchd_service.md.erb
inspec-2.1.10 docs/resources/launchd_service.md.erb
inspec-2.0.32 docs/resources/launchd_service.md.erb
inspec-2.0.17 docs/resources/launchd_service.md.erb