def rc(
    state, host, name,
    running=True, restarted=False, reloaded=False,
    command=None, enabled=None,
):
    '''
    Manage the state of BSD init (/etc/rc.d) services.

    + name: name of the service to manage
    + running: whether the service should be running
    + restarted: whether the service should be restarted
    + reloaded: whether the service should be reloaded
    + command: custom command to pass like: ``/etc/rc.d/<name> <command>``
    + enabled: whether this service should be enabled/disabled on boot
    '''

    yield _handle_service_control(
        name, host.fact.rcd_status,
        '/etc/rc.d/{0} {1}',
        running, restarted, reloaded, command,
        status_argument='check',
    )

    # BSD init is simple, just add/remove <name>_enabled="YES"
    if isinstance(enabled, bool):
        yield files.line(
            state, host,
            '/etc/rc.conf.local',
            '^{0}_enable='.format(name),
            replace='{0}_enable="YES"'.format(name),
            present=enabled,
        )
Manage the state of BSD init (/etc/rc.d) services.

    + name: name of the service to manage
    + running: whether the service should be running
    + restarted: whether the service should be restarted
    + reloaded: whether the service should be reloaded
    + command: custom command to pass like: ``/etc/rc.d/<name> <command>``
    + enabled: whether this service should be enabled/disabled on boot