Skip to content

Systemd microservice to manage service in systemd user space

License

Notifications You must be signed in to change notification settings

bmv3cg/systemd-microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Systemd-microservice

Systemd microservice api to manage a systemd unit which is running in user space. Normally systemd services are configured with root user account and requires sudo permissions to manage service. Systemd microservice uses a systemd service with user configuration and enables user to manage systemd service with minimal permissions through an API. You can find details of configuring systemd as user here

Configuration

You can configure the systemd service which is managed by micorservice in this config file

Service health

You can check the health of systemd service using the following get reqeust. Replace systemdd-service.local with your hostname.

curl  -H "Accept: application/json"  https://systemd-service.local:8080/api/v1/service/health
{
  "statuscode": 200,
  "unitname": "systemd-test-user.service",
  "unitstatus": "systemd unit running"
} 

Starting service

You can start the systemd service using the following post reqeust. Replace systemdd-service.local with your hostname.

curl -X POST -H "Accept: application/json"  https://systemd-service.local:8080/api/v1/service/start  
{
  "statuscode": 200,
  "unitname": "systemd-test-user.service",
  "unitstatus": "systemd unit started"

Stopping service

You can stop the systemd service using the following post reqeust. Replace systemdd-service.local with your hostname.

curl -X POST -H "Accept: application/json"  https://systemd-service.local:8080/api/v1/service/stop 
{
  "statuscode": 200,
  "unitname": "systemd-test-user.service",
  "unitstatus": "systemd unit stopped"
}

Restarting service

You can restart the systemd service using the following post reqeust. Replace systemdd-service.local with your hostname.

curl -X POST -H "Accept: application/json"  https://systemd-service.local:8080/api/v1/service/restart
{
  "statuscode": 200,
  "unitname": "systemd-test-user.service",
  "unitstatus": "systemd unit restarted"
} 

About

Systemd microservice to manage service in systemd user space

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages