3.13. services

The services class manages all the background daemons on the system.

Every services class request contains several parameters:

Parameter Value Description
id   Any unique value for the request, including a hash, checksum, or uuid.
name services  
namespace sysadm  
action   Actions include “disable”, “enable”, “list_services”, “restart”, “start”, and “stop”

The rest of this section provides examples of the available actions for each type of request, along with their responses.

3.13.1. Disable

The disable command will tag the service to no longer startup upon (re)booting the system.

REST Request

PUT /sysadm/services
{
   "action": "disable",
   "services": [
      "cupsd"
   ]
}

WebSocket Request

{
  "args": {
     "action": "disable",
     "services": [
       "cupsd"
     ]
  },
  "name" : "services",
  "id" : "fooid",
  "namespace" : "sysadm"
}

Response

{
 "args": {
   "services_disabled": [
     "cupsd"
   ]
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.13.2. Enable

The enable command will mark the service for startup upon (re)booting the system.

REST Request

PUT /sysadm/services
{
   "action": "enable",
   "services": [
      "cupsd"
   ]
}

WebSocket Request

{
  "args": {
     "action": "enable",
     "services": [
       "cupsd"
     ]
  },
  "name" : "services",
  "id" : "fooid",
  "namespace" : "sysadm"
}

Response

{
 "args": {
   "services_enabled": [
     "cupsd"
   ]
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.13.3. List Services

The list_services action returns a list of all services available on the system.

Note

The response message has been shortened for the example. Many more services will be typically listed.

REST Request

PUT /sysadm/services
{
   "action" : "list_services"
}

WebSocket Request

{
   "args" : {
      "action" : "list_services"
   },
   "id" : "fooid",
   "namespace" : "sysadm",
   "name" : "services"
}

Response

{
  "args": {
    "services": {
      "accounting": {
        "description": "",
        "is_enabled": "false",
        "name": "accounting",
        "path": "/etc/rc.d/accounting",
        "tag": "accounting_enable",
        "is_running": "false"
      },
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}

3.13.4. Restart

restart will stop, then immediately start the specified service(s).

REST Request

PUT /sysadm/services
{
   "action": "restart",
   "services": [
      "cupsd"
   ]
}

WebSocket Request

{
  "args": {
     "action": "restart",
     "services": [
       "cupsd"
     ]
  },
  "name" : "services",
  "id" : "fooid",
  "namespace" : "sysadm"
}

Response

{
 "args": {
   "services_restarted": [
     "cupsd"
   ]
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.13.5. Start

The start command will start a specified service(s).

REST Request

PUT /sysadm/services
{
   "action": "start",
   "services": [
      "cupsd"
   ]
}

WebSocket Request

{
  "args": {
     "action": "start",
     "services": [
       "cupsd"
     ]
  },
  "name" : "services",
  "id" : "fooid",
  "namespace" : "sysadm"
}

Response

{
 "args": {
   "services_started": [
     "cupsd"
   ]
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.13.6. Stop

The stop command will halt a specified service(s).

REST Request

PUT /sysadm/services
{
   "action": "stop",
   "services": [
      "cupsd"
   ]
}

WebSocket Request

{
  "args": {
     "action": "stop",
     "services": [
       "cupsd"
     ]
  },
  "name" : "services",
  "id" : "fooid",
  "namespace" : "sysadm"
}

Response

{
 "args": {
   "services_stopped": [
     "cupsd"
   ]
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}