System Services

The OpenDrives API can help you manage the services living on your system

Service Basics

You can list, enable, disable, restart, view details, view log, and view info of any system service.

List Services

Call to /system/service to list all services

Request Object

+ URL
  /api/v2/system/service

+ Method
  GET

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {}

Response Object

After sending this request, you will receive a list of all services back.

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  [
    {
        "id": "systemd-user-sessions.service",
        "state": "online",
        "locked": true
    },
    {
        "id": "cron.service",
        "state": "online",
        "locked": false
    },
    {
        "id": "systemd-localed.service",
        "state": "offline",
        "locked": true
    }
  ]

Get Service Details

You can also get the details of one service.

Request Object

+ URL
  /api/v2/system/service/$SERVICE_NAME/details

+ Method
  GET

+ Parameters
  service name (string, required, URL Param) - the name of the service to get details on

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {}

Response Object

After sending this request, you will receive the one service back.

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  [
    {
      "id": "cron.service",
      "state": "online",
      "locked": false
    }
  ]

Disable a Service

You may disable a service via the API. Be careful not to disable a critical system service.

Request Object

+ URL
  /api/v2/system/service/$SERVICE_NAME/disable

+ Method
  POST

+ Parameters
  service name (string, required, URL Param) - the name of the service to disable

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {}

Response Object

After sending this request, you will receive information about the service you have disabled.

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  "● watchtower.service - OpenDrives Notification Service\n   Loaded: loaded (/lib/systemd/system/watchtower.service; disabled; vendor preset: enabled)\n   Active: inactive (dead) since Fri 2020-09-25 09:23:20 PDT; 36ms ago\n  Process: 9727 ExecStart=/usr/share/watchtower/app/bin/watchtower.js (code=killed, signal=TERM)\n Main PID: 9727 (code=killed, signal=TERM)\n\nSep 25 08:05:54 greed watchtower.js[9727]: ========================\nSep 25 08:05:54 greed watchtower.js[9727]: Hello! I'm Watchtower_res_09e3b2bd#a9cd45aa-b385-481b-8a4f-75e2a3f700fa on 8000\nSep 25 08:05:54 greed watchtower.js[9727]: ========================\nSep 25 08:05:55 greed watchtower.js[9727]: {\"level\":30,\"time\":1601046355563,\"pid\":9727,\"hostname\":\"greed\",\"msg\":\"Loaded up 2 Watchtower Agents\"}\nSep 25 08:05:55 greed watchtower.js[9727]: {\"level\":30,\"time\":1601046355565,\"pid\":9727,\"hostname\":\"greed\",\"msg\":\"2 valid agents\"}\nSep 25 08:05:55 greed watchtower.js[9727]: {\"level\":30,\"time\":1601046355565,\"pid\":9727,\"hostname\":\"greed\",\"msg\":\"Agents loaded and validated\"}\nSep 25 09:23:19 sue systemd[1]: Stopping OpenDrives Notification Service...\nSep 25 09:23:20 sue systemd[1]: watchtower.service: Main process exited, code=killed, status=15/TERM\nSep 25 09:23:20 sue systemd[1]: watchtower.service: Succeeded.\nSep 25 09:23:20 sue systemd[1]: Stopped OpenDrives Notification Service.\n"

Enable a Service

You may enable a service via the API. Be careful when enabling a system services.

Request Object

+ URL
  /api/v2/system/service/$SERVICE_NAME/enable

+ Method
  POST

+ Parameters
  service name (string, required, URL Param) - the name of the service to enable

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {}

Response Object

After sending this request, you will receive information about the service you have enabled.

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  "● watchtower.service - OpenDrives Notification Service\n   Loaded: loaded (/lib/systemd/system/watchtower.service; enabled; vendor preset: enabled)\n   Active: active (running) since Fri 2020-09-25 09:24:54 PDT; 1s ago\n Main PID: 22634 (node)\n    Tasks: 11 (limit: 4915)\n   Memory: 49.0M\n   CGroup: /system.slice/watchtower.service\n           └─22634 node /usr/share/watchtower/app/bin/watchtower.js\n\nSep 25 09:24:54 sue systemd[1]: Started OpenDrives Notification Service.\nSep 25 09:24:54 sue watchtower.js[22634]: Hello! I'm Watchtower_req_Lodestar_09e3b2bd#4f56a25c-6489-45c4-bd90-7f785fb19e4e\nSep 25 09:24:54 sue watchtower.js[22634]: ========================\nSep 25 09:24:54 sue watchtower.js[22634]: Hello! I'm Watchtower_res_09e3b2bd#d2d4fc83-0435-4c20-8b30-61deca0f1993 on 8000\nSep 25 09:24:54 sue watchtower.js[22634]: ========================\nSep 25 09:24:55 sue watchtower.js[22634]: {\"level\":30,\"time\":1601051095036,\"pid\":22634,\"hostname\":\"sue\",\"msg\":\"Loaded up 2 Watchtower Agents\"}\nSep 25 09:24:55 sue watchtower.js[22634]: {\"level\":30,\"time\":1601051095039,\"pid\":22634,\"hostname\":\"sue\",\"msg\":\"2 valid agents\"}\nSep 25 09:24:55 sue watchtower.js[22634]: {\"level\":30,\"time\":1601051095039,\"pid\":22634,\"hostname\":\"sue\",\"msg\":\"Agents loaded and validated\"}\n"

Restart a Service

You may restart a service via the API. Be careful when restarting a system services.

Request Object

+ URL
  /api/v2/system/service/$SERVICE_NAME/restart

+ Method
  POST

+ Parameters
  service name (string, required, URL Param) - the name of the service to restart

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {}

Response Object

After sending this request, you will receive information about the service you have restarted.

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  "● watchtower.service - OpenDrives Notification Service\n   Loaded: loaded (/lib/systemd/system/watchtower.service; enabled; vendor preset: enabled)\n   Active: active (running) since Fri 2020-09-25 09:25:17 PDT; 3ms ago\n Main PID: 23215 (node)\n    Tasks: 1 (limit: 4915)\n   Memory: 352.0K\n   CGroup: /system.slice/watchtower.service\n           └─23215 node /usr/share/watchtower/app/bin/watchtower.js\n\nSep 25 09:25:17 sue systemd[1]: Started OpenDrives Notification Service.\n"

View Service Log

You may view a service log via the API.

Request Object

+ URL
  /api/v2/system/service/$SERVICE_NAME/log

+ Method
  POST

+ Parameters
  service name (string, required, URL Param) - the name of the service to view log of

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {}

Response Object

After sending this request, you will receive the log information of the service.

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  {
    "data": "Sep 21 11:40:48 greed watchtower.js[3770]: {\"level\":30,\"time\":1600713648678,\"pid\":3770,\"hostname\":\"greed\",\"msg\":\"2 valid agents\"}\nSep 21 11:40:48 greed watchtower.js[3770]: {\"level\":30,\"time\":1600713648678,\"pid\":3770,\"hostname\":\"greed\",\"msg\":\"Agents loaded and validated\"}\nSep 22 08:54:59 greed systemd[1]: Stopping OpenDrives Notification Service...\nSep 22 08:54:59 greed systemd[1]: watchtower.service: Main process exited, code=killed, status=15/TERM\nSep 22 08:54:59 greed systemd[1]: watchtower.service: Succeeded.\nSep 22 08:54:59 greed systemd[1]: Stopped OpenDrives Notification Service.\nSep 22 08:54:59 greed systemd[1]: Started OpenDrives Notification Service.\nSep 22 08:54:59 greed watchtower.js[5382]: Hello! I'm Watchtower_req_Lodestar_09e3b2bd#aab86f57-ef22-4507-9ac2-6bb55f61fd04\nSep 22 08:54:59 greed watchtower.js[5382]: ========================\nSep 22 08:54:59 greed watchtower.js[5382]: Hello! I'm Watchtower_res_09e3b2bd#ab70a4e2-b6a6-4372-bc0e-3af43c1c71d5 on 8000\nSep 22 08:54:59 greed watchtower.js[5382]: ========================\nSep 22 08:55:00 greed watchtower.js[5382]: {\"level\":30,\"time\":1600790100347,\"pid\":5382,\"hostname\":\"greed\",\"msg\":\"Loaded up 2 Watchtower Agents\"}\nSep 22 08:55:00 greed watchtower.js[5382]: {\"level\":30,\"time\":1600790100350,\"pid\":5382,\"hostname\":\"greed\",\"msg\":\"2 valid agents\"}\nSep 22 08:55:00 greed watchtower.js[5382]: {\"level\":30,\"time\":1600790100350,\"pid\":5382,\"hostname\":\"greed\",\"msg\":\"Agents loaded and validated\"}\nSep 22 09:01:49 greed systemd[1]: Stopping OpenDrives Notification Service...\nSep 22 09:01:50 greed systemd[1]: watchtower.service: Main process exited, code=killed, status=15/TERM\nSep 22 09:01:50 greed systemd[1]: watchtower.service: Succeeded.\nSep 22 09:01:50 greed systemd[1]: Stopped OpenDrives Notification Service.\nSep 22 09:01:50 greed systemd[1]: Started OpenDrives Notification Service.\nSep 22 09:01:50 greed watchtower.js[16277]: Hello! I'm Watchtower_req_Lodestar_09e3b2bd#868d08e5-a354-4280-b935-af7076fda038\nSep 22 09:01:50 greed watchtower.js[16277]: ========================\nSep 22 09:01:50 greed watchtower.js[16277]: Hello! I'm Watchtower_res_09e3b2bd#7343655f-16b3-4810-a06b-6e0de1794641 on 8000\nSep 22 09:01:50 greed watchtower.js[16277]: ========================\nSep 22 09:01:50 greed watchtower.js[16277]: {\"level\":30,\"time\":1600790510992,\"pid\":16277,\"hostname\":\"greed\",\"msg\":\"Loaded up 2 Watchtower Agents\"}\nSep 22 09:01:50 greed watchtower.js[16277]: {\"level\":30,\"time\":1600790510994,\"pid\":16277,\"hostname\":\"greed\",\"msg\":\"2 valid agents\"}\nSep 22 09:01:50 greed watchtower.js[16277]: {\"level\":30,\"time\":1600790510994,\"pid\":16277,\"hostname\":\"greed\",\"msg\":\"Agents loaded and validated\"}\nSep 22 11:32:17 greed systemd[1]: Stopping OpenDrives Notification Service...\nSep 22 11:32:17 greed systemd[1]: watchtower.service: Main process exited, code=killed, status=15/TERM\nSep 22 11:32:17 greed systemd[1]: watchtower.service: Succeeded.\nSep 22 11:32:17 greed systemd[1]: Stopped OpenDrives Notification Service.\nSep 22 11:32:17 greed systemd[1]: Started OpenDrives Notification Service.\nSep 22 11:32:17 greed watchtower.js[30340]: Hello! I'm Watchtower_req_Lodestar_09e3b2bd#1649fd60-74a2-4504-a0b8-3b144f278115\nSep 22 11:32:17 greed watchtower.js[30340]: ========================\nSep 22 11:32:17 greed watchtower.js[30340]: Hello! I'm Watchtower_res_09e3b2bd#bdfa240d-59c1-42a4-b91e-e30a94286f00 on 8000\nSep 22 11:32:17 greed watchtower.js[30340]: ========================\nSep 22 11:32:18 greed watchtower.js[30340]: {\"level\":30,\"time\":1600799538068,\"pid\":30340,\"hostname\":\"greed\",\"msg\":\"Loaded up 2 Watchtower Agents\"}\nSep 22 11:32:18 greed watchtower.js[30340]: {\"level\":30,\"time\":1600799538071,\"pid\":30340,\"hostname\":\"greed\",\"msg\":\"2 valid agents\"}\nSep 22 11:32:18 greed watchtower.js[30340]: {\"level\":30,\"time\":1600799538071,\"pid\":30340,\"hostname\":\"greed\",\"msg\":\"Agents loaded and validated\"}\nSep 22 11:34:50 greed systemd[1]: Stopping OpenDrives Notification Service...\nSep 22 11:34:50 greed systemd[1]: watchtower.service: Main process exited, code=killed, status=15/TERM\nSep 22 11:34:50 greed systemd[1]: watchtower.service: Succeeded.\nSep 22 11:34:50 greed systemd[1]: Stopped OpenDrives Notification Service.\nSep 22 11:34:50 greed systemd[1]: Started OpenDrives Notification Service.\nSep 22 11:34:51 greed watchtower.js[20512]: Hello! I'm Watchtower_req_Lodestar_09e3b2bd#81b37e3c-1a3d-4f66-a7ab-f53e8d9eb82b\nSep 22 11:34:51 greed watchtower.js[20512]: ========================\nSep 22 11:34:51 greed watchtower.js[20512]: Hello! I'm Watchtower_res_09e3b2bd#f8f95feb-55d9-45e9-a76d-4fce18ab7d19 on 8000\nSep 22 11:34:51 greed watchtower.js[20512]: ========================\nSep 22 11:34:51 greed watchtower.js[20512]: {\"level\":30,\"time\":1600799691788,\"pid\":20512,\"hostname\":\"greed\",\"msg\":\"Loaded up 2 Watchtower Agents\"}\nSep 22 11:34:51 greed watchtower.js[20512]: {\"level\":30,\"time\":1600799691791,\"pid\":20512,\"hostname\":\"greed\",\"msg\":\"2 valid agents\"}\nSep 22 11:34:51 greed watchtower.js[20512]: {\"level\":30,\"time\":1600799691791,\"pid\":20512,\"hostname\":\"greed\",\"msg\":\"Agents loaded and validated\"}\nSep 22 12:00:45 greed systemd[1]: Stopping OpenDrives Notification Service...\nSep 22 12:00:45 greed systemd[1]: watchtower.service: Main process exited, code=killed, status=15/TERM\nSep 22 12:00:45 greed systemd[1]: watchtower.service: Succeeded.\nSep 22 12:00:45 greed systemd[1]: Stopped OpenDrives Notification Service.\nSep 22 12:00:45 greed systemd[1]: Started OpenDrives Notification Service.\nSep 22 12:00:46 greed watchtower.js[10434]: Hello! I'm Watchtower_req_Lodestar_09e3b2bd#06040f07-be69-45d2-84a4-b2f4a4ebb41b\nSep 22 12:00:46 greed watchtower.js[10434]: ========================\nSep 22 12:00:46 greed watchtower.js[10434]: Hello! I'm Watchtower_res_09e3b2bd#3dc680da-b5d2-44b7-a141-2a1e339f2e5f on 8000\nSep 22 12:00:46 greed watchtower.js[10434]: ========================\nSep 22 12:00:46 greed watchtower.js[10434]: {\"level\":30,\"time\":1600801246958,\"pid\":10434,\"hostname\":\"greed\",\"msg\":\"Loaded up 2 Watchtower Agents\"}\nSep 22 12:00:46 greed watchtower.js[10434]: {\"level\":30,\"time\":1600801246961,\"pid\":10434,\"hostname\":\"greed\",\"msg\":\"2 valid agents\"}\nSep 22 12:00:46 greed watchtower.js[10434]: {\"level\":30,\"time\":1600801246961,\"pid\":10434,\"hostname\":\"greed\",\"msg\":\"Agents loaded and validated\"}\nSep 22 12:01:08 greed systemd[1]: Stopping OpenDrives Notification Service...\nSep 22 12:01:08 greed systemd[1]: watchtower.service: Main process exited, code=killed, status=15/TERM\nSep 22 12:01:08 greed systemd[1]: watchtower.service: Succeeded.\nSep 22 12:01:08 greed systemd[1]: Stopped OpenDrives Notification Service.\nSep 22 12:01:08 greed systemd[1]: Started OpenDrives Notification Service.\nSep 22 12:01:08 greed watchtower.js[11278]: Hello! I'm Watchtower_req_Lodestar_09e3b2bd#4bbce5dc-dacc-4f45-9701-90e1b798458e\nSep 22 12:01:08 greed watchtower.js[11278]: ========================\nSep 22 12:01:08 greed watchtower.js[11278]: Hello! I'm Watchtower_res_09e3b2bd#689a3cd2-7dfc-4fea-b998-3965b89bbd97 on 8000\nSep 22 12:01:08 greed watchtower.js[11278]: ========================\nSep 22 12:01:09 greed watchtower.js[11278]: {\"level\":30,\"time\":1600801269082,\"pid\":11278,\"hostname\":\"greed\",\"msg\":\"Loaded up 2 Watchtower Agents\"}\nSep 22 12:01:09 greed watchtower.js[11278]: {\"level\":30,\"time\":1600801269084,\"pid\":11278,\"hostname\":\"greed\",\"msg\":\"2 valid agents\"}\nSep 22 12:01:09 greed watchtower.js[11278]: {\"level\":30,\"time\":1600801269084,\"pid\":11278,\"hostname\":\"greed\",\"msg\":\"Agents loaded and validated\"}\nSep 24 19:30:24 greed systemd[1]: Stopping OpenDrives Notification Service...\nSep 24 19:30:24 greed systemd[1]: watchtower.service: Main process exited, code=killed, status=15/TERM\nSep 24 19:30:24 greed systemd[1]: watchtower.service: Succeeded.\nSep 24 19:30:24 greed systemd[1]: Stopped OpenDrives Notification Service.\nSep 24 19:30:24 greed systemd[1]: Started OpenDrives Notification Service.\nSep 24 19:30:25 greed watchtower.js[17741]: Hello! I'm Watchtower_req_Lodestar_09e3b2bd#60517976-00ff-4c93-a88a-cfd6a000713e\nSep 24 19:30:25 greed watchtower.js[17741]: ========================\nSep 24 19:30:25 greed watchtower.js[17741]: Hello! I'm Watchtower_res_09e3b2bd#67944d61-9fc3-4aea-a381-d5d942fbeb8d on 8000\nSep 24 19:30:25 greed watchtower.js[17741]: ========================\nSep 24 19:30:25 greed watchtower.js[17741]: {\"level\":30,\"time\":1601001025760,\"pid\":17741,\"hostname\":\"greed\",\"msg\":\"Loaded up 2 Watchtower Agents\"}\nSep 24 19:30:25 greed watchtower.js[17741]: {\"level\":30,\"time\":1601001025762,\"pid\":17741,\"hostname\":\"greed\",\"msg\":\"2 valid agents\"}\nSep 24 19:30:25 greed watchtower.js[17741]: {\"level\":30,\"time\":1601001025762,\"pid\":17741,\"hostname\":\"greed\",\"msg\":\"Agents loaded and validated\"}\nSep 25 08:05:54 greed systemd[1]: Stopping OpenDrives Notification Service...\nSep 25 08:05:54 greed systemd[1]: watchtower.service: Main process exited, code=killed, status=15/TERM\nSep 25 08:05:54 greed systemd[1]: watchtower.service: Succeeded.\nSep 25 08:05:54 greed systemd[1]: Stopped OpenDrives Notification Service.\nSep 25 08:05:54 greed systemd[1]: Started OpenDrives Notification Service.\nSep 25 08:05:54 greed watchtower.js[9727]: Hello! I'm Watchtower_req_Lodestar_09e3b2bd#326f91fa-94e1-4d88-8082-9da7ee55c3a2\nSep 25 08:05:54 greed watchtower.js[9727]: ========================\nSep 25 08:05:54 greed watchtower.js[9727]: Hello! I'm Watchtower_res_09e3b2bd#a9cd45aa-b385-481b-8a4f-75e2a3f700fa on 8000\nSep 25 08:05:54 greed watchtower.js[9727]: ========================\nSep 25 08:05:55 greed watchtower.js[9727]: {\"level\":30,\"time\":1601046355563,\"pid\":9727,\"hostname\":\"greed\",\"msg\":\"Loaded up 2 Watchtower Agents\"}\nSep 25 08:05:55 greed watchtower.js[9727]: {\"level\":30,\"time\":1601046355565,\"pid\":9727,\"hostname\":\"greed\",\"msg\":\"2 valid agents\"}\nSep 25 08:05:55 greed watchtower.js[9727]: {\"level\":30,\"time\":1601046355565,\"pid\":9727,\"hostname\":\"greed\",\"msg\":\"Agents loaded and validated\"}\nSep 25 09:23:19 sue systemd[1]: Stopping OpenDrives Notification Service...\nSep 25 09:23:20 sue systemd[1]: watchtower.service: Main process exited, code=killed, status=15/TERM\nSep 25 09:23:20 sue systemd[1]: watchtower.service: Succeeded.\nSep 25 09:23:20 sue systemd[1]: Stopped OpenDrives Notification Service.\nSep 25 09:24:54 sue systemd[1]: Started OpenDrives Notification Service.\nSep 25 09:24:54 sue watchtower.js[22634]: Hello! I'm Watchtower_req_Lodestar_09e3b2bd#4f56a25c-6489-45c4-bd90-7f785fb19e4e\nSep 25 09:24:54 sue watchtower.js[22634]: ========================\nSep 25 09:24:54 sue watchtower.js[22634]: Hello! I'm Watchtower_res_09e3b2bd#d2d4fc83-0435-4c20-8b30-61deca0f1993 on 8000\nSep 25 09:24:54 sue watchtower.js[22634]: ========================\nSep 25 09:24:55 sue watchtower.js[22634]: {\"level\":30,\"time\":1601051095036,\"pid\":22634,\"hostname\":\"sue\",\"msg\":\"Loaded up 2 Watchtower Agents\"}\nSep 25 09:24:55 sue watchtower.js[22634]: {\"level\":30,\"time\":1601051095039,\"pid\":22634,\"hostname\":\"sue\",\"msg\":\"2 valid agents\"}\nSep 25 09:24:55 sue watchtower.js[22634]: {\"level\":30,\"time\":1601051095039,\"pid\":22634,\"hostname\":\"sue\",\"msg\":\"Agents loaded and validated\"}\nSep 25 09:25:17 sue systemd[1]: Stopping OpenDrives Notification Service...\nSep 25 09:25:17 sue systemd[1]: watchtower.service: Main process exited, code=killed, status=15/TERM\nSep 25 09:25:17 sue systemd[1]: watchtower.service: Succeeded.\nSep 25 09:25:17 sue systemd[1]: Stopped OpenDrives Notification Service.\nSep 25 09:25:17 sue systemd[1]: Started OpenDrives Notification Service.\nSep 25 09:25:17 sue watchtower.js[23215]: Hello! I'm Watchtower_req_Lodestar_09e3b2bd#317d6eda-8669-4356-9fca-faa868f0c91f\nSep 25 09:25:17 sue watchtower.js[23215]: ========================\nSep 25 09:25:17 sue watchtower.js[23215]: Hello! I'm Watchtower_res_09e3b2bd#16f907f7-bd11-4a70-b0d9-ac3e1316d94f on 8000\nSep 25 09:25:17 sue watchtower.js[23215]: ========================\nSep 25 09:25:18 sue watchtower.js[23215]: {\"level\":30,\"time\":1601051118159,\"pid\":23215,\"hostname\":\"sue\",\"msg\":\"Loaded up 2 Watchtower Agents\"}\nSep 25 09:25:18 sue watchtower.js[23215]: {\"level\":30,\"time\":1601051118161,\"pid\":23215,\"hostname\":\"sue\",\"msg\":\"2 valid agents\"}\nSep 25 09:25:18 sue watchtower.js[23215]: {\"level\":30,\"time\":1601051118161,\"pid\":23215,\"hostname\":\"sue\",\"msg\":\"Agents loaded and validated\"}",
    "logLength": 122
  }

View Service Information

You may view a service information via the API.

Request Object

+ URL
  /api/v2/system/service/$SERVICE_NAME/info

+ Method
  POST

+ Parameters
  service name (string, required, URL Param) - the name of the service to view info of

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {}

Response Object

After sending this request, you will receive detailed information about the service you have requested.

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  {
    "textData": "● watchtower.service - OpenDrives Notification Service\n   Loaded: loaded (/lib/systemd/system/watchtower.service; enabled; vendor preset: enabled)\n   Active: active (running) since Fri 2020-09-25 09:25:17 PDT; 2min 31s ago\n Main PID: 23215 (node)\n    Tasks: 11 (limit: 4915)\n   Memory: 40.7M\n   CGroup: /system.slice/watchtower.service\n           └─23215 node /usr/share/watchtower/app/bin/watchtower.js\nSep 25 09:25:17 sue systemd[1]: Started OpenDrives Notification Service.\nSep 25 09:25:17 sue watchtower.js[23215]: Hello! I'm Watchtower_req_Lodestar_09e3b2bd#317d6eda-8669-4356-9fca-faa868f0c91f\nSep 25 09:25:17 sue watchtower.js[23215]: ========================\nSep 25 09:25:17 sue watchtower.js[23215]: Hello! I'm Watchtower_res_09e3b2bd#16f907f7-bd11-4a70-b0d9-ac3e1316d94f on 8000\nSep 25 09:25:17 sue watchtower.js[23215]: ========================\nSep 25 09:25:18 sue watchtower.js[23215]: {\"level\":30,\"time\":1601051118159,\"pid\":23215,\"hostname\":\"sue\",\"msg\":\"Loaded up 2 Watchtower Agents\"}\nSep 25 09:25:18 sue watchtower.js[23215]: {\"level\":30,\"time\":1601051118161,\"pid\":23215,\"hostname\":\"sue\",\"msg\":\"2 valid agents\"}\nSep 25 09:25:18 sue watchtower.js[23215]: {\"level\":30,\"time\":1601051118161,\"pid\":23215,\"hostname\":\"sue\",\"msg\":\"Agents loaded and validated\"}",
    "logfile": "watchtower"
  }

Clear Failed Services

You may clear the failed state of a service unit via the API.

Request Object

+ URL
  /api/v2/system/service/$SERVICE_NAME/clear

+ Method
  POST

+ Parameters
  service name (string, required, URL Param) - the name of the service to clear

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {}

Response Object

After sending this request, you will receive information about the service you have cleared.

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  [
    {
        "id": "miniod.service",
        "state": "online",
        "locked": false
    }
  ]