Control systemd services through Web or REST API

Óscar García Amor 0907028a79 Updated 4 years ago
sysdweb 574f13c8b3 Merge branch 'master' of 4 years ago
systemd 2d7005e049 Added systemd units 4 years ago
.gitignore 3e945d6473 Initial commit 4 years ago
LICENSE 3e945d6473 Initial commit 4 years ago 0907028a79 Updated 4 years ago
requirements.txt 2e3344d7d2 Added requirements, setup and sample config 4 years ago be7d1182c5 Added journal support 4 years ago
sysdweb.conf be6abd68e8 Added host and port settings to configuration file 4 years ago 11edcdaa0b Initial import 4 years ago


Control systemd services through Web or REST API


git clone
virtualenv3 ./sysdweb-venv
source ./sysdweb-venv/bin/activate
cd sysdweb
python install

Arch Linux users can install sysdweb from AUR.


First take a look to sysdweb.conf file to configure sysdweb. Is self explanatory.

You can place sysdweb.conf in /etc for system, in user home ~/.config/sysdweb/sysdweb.conf or in same directory where you run sysdweb.

Once you have configured sysdweb, simply run.


By default sysdweb listen in 10080 port to, you can change listen port and address with -p and -l.

sysdweb -p 9080 -l


You can control configured services via REST API, for example, with curl.

The API endpoint is /api/v1/<service>/<action>, always GET and response a json with following format.

  "<action>": "<result>"

The <service> tag is defined in config file and match with section label. For example, in following config, the service would be ngx.

title = Nginx
unit = nginx.service

The posible <actions> are.

  • start
  • stop
  • restart
  • reload
  • reloadorrestart
  • status
  • journal

All actions (except status and journal) return as result OK if can communicate with DBUS or Fail if any error occurs.

For status action, the posible responses are.

  • active (started unit)
  • reloading
  • inactive (stopped unit)
  • failed (stopped unit)
  • activating
  • deactivating
  • not-found (for inexistent unit)

For journal action you can pass the number of lines that you want view from tail of journal file. By default /api/v1/<service>/journal returns 100 lines.

By default /api/v1/<service>/journal returns 100 tail lines of journal file of <service> unit. You can specify the number of lines by this way.


In the example defined above all valid enpoins are.<number>