# salt.modules.upstart_service

Module for the management of upstart systems. The Upstart system only supports service starting, stopping and restarting.

Important

If you feel that Salt should be using this module to manage services on a minion, and it is using a different module (or gives an error similar to 'service.start' is not available), see here.

Currently (as of Ubuntu 12.04) there is no tool available to disable Upstart services (like update-rc.d). This[1] is the recommended way to disable an Upstart service. So we assume that all Upstart services that have not been disabled in this manner are enabled.

But this is broken because we do not check to see that the dependent services are enabled. Otherwise we would have to do something like parse the output of "initctl show-config" to determine if all service dependencies are enabled to start on boot. For example, see the "start on" condition for the lightdm service below[2]. And this would be too hard. So we wait until the upstart developers have solved this problem. :) This is to say that an Upstart service that is enabled may not really be enabled.

Also, when an Upstart service is enabled, should the dependent services be enabled too? Probably not. But there should be a notice about this, at least.

[1] http://upstart.ubuntu.com/cookbook/#disabling-a-job-from-automatically-starting

[2] example upstart configuration file:

    lightdm
    emits login-session-start
    emits desktop-session-start
    emits desktop-shutdown
    start on ((((filesystem and runlevel [!06]) and started dbus) and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1 or stopped udev-fallback-graphics)) or runlevel PREVLEVEL=S)
    stop on runlevel [016]

Warning

This module should not be used on Red Hat systems. For these, the `rh_service` module should be used, as it supports the hybrid upstart/sysvinit system used in RHEL/CentOS 6.

salt.modules.upstart_service.available(name)

  Returns `True` if the specified service is available, otherwise returns `False`.

  CLI Example:

      salt '*' service.available sshd

salt.modules.upstart_service.disable(name, **kwargs)

  Disable the named service from starting on boot

  CLI Example:

      salt '*' service.disable <service name>

salt.modules.upstart_service.disabled(name)

  Check to see if the named service is disabled to start on boot

  CLI Example:

      salt '*' service.disabled <service name>

salt.modules.upstart_service.enable(name, **kwargs)

  Enable the named service to start at boot

  CLI Example:

      salt '*' service.enable <service name>

salt.modules.upstart_service.enabled(name, **kwargs)

  Check to see if the named service is enabled to start on boot

  CLI Example:

      salt '*' service.enabled <service name>

salt.modules.upstart_service.force_reload(name)

  Force-reload the named service

  CLI Example:

      salt '*' service.force_reload <service name>

salt.modules.upstart_service.full_restart(name)

  Do a full restart (stop/start) of the named service

  CLI Example:

      salt '*' service.full_restart <service name>

salt.modules.upstart_service.get_all()

  Return all installed services

  CLI Example:

      salt '*' service.get_all

salt.modules.upstart_service.get_disabled()

  Return the disabled services

  CLI Example:

      salt '*' service.get_disabled

salt.modules.upstart_service.get_enabled()

  Return the enabled services

  CLI Example:

      salt '*' service.get_enabled

salt.modules.upstart_service.missing(name)

  The inverse of service.available. Returns `True` if the specified service is not available, otherwise returns `False`.

  CLI Example:

      salt '*' service.missing sshd

salt.modules.upstart_service.reload_(name)

  Reload the named service

  CLI Example:

      salt '*' service.reload <service name>

salt.modules.upstart_service.restart(name)

  Restart the named service

  CLI Example:

      salt '*' service.restart <service name>

salt.modules.upstart_service.start(name)

  Start the specified service

  CLI Example:

      salt '*' service.start <service name>

salt.modules.upstart_service.status(name, sig=None)

  Return the status for a service. If the name contains globbing, a dict mapping service name to True/False values is returned.

  Changed in version 2018.3.0: The service name can now be a glob (e.g. `salt*`)

  Parameters:

    - name (str) -- The name of the service to check

    - sig (str) -- Signature to use to find the service via ps

  Returns:

    True if running, False otherwise dict: Maps service name to True if running, False otherwise

  Return type:

    bool

  CLI Example:

      salt '*' service.status <service name> [service signature]

salt.modules.upstart_service.stop(name)

  Stop the specified service

  CLI Example:

      salt '*' service.stop <service name>