Simple REST server to manipulate system services via systemctl
npm install systemctl-restREST endpoint for manipulation of system services. This serves as a thin wrapper
around native linux systemctl command (leveraging sysctlx package).
http://localhost:/service/ - returns structured systemctl status in JSONhttp://localhost:/service//enable - calls systemctl enablehttp://localhost:/service//disable - calls systemctl disablehttp://localhost:/service//start - calls systemctl starthttp://localhost:/service//stop - calls systemctl stophttp://localhost:/service//restart - calls systemctl restartWhen invoked directly from the command line, systemctl-rest configures express
server instance and automatically starts listening on given port.
$ sudo node systemctl-rest (with default port 8181)
$ sudo node systemctl-rest 8080
In case you would like to build on top of this package you could reuse the existing
configured express instance and add your own routing paths with respective
handlers. This helps you to avoid combining multiple server instances to achieve
your goal with systemctl.
Please note that in this scenario you need to retrieve the port and start listening
on it yourself:
````
let server = require('systemctl-rest').server;.. add your paths
server.get('/my/custom/path', myHandlerFunction);.. start the server
server.listen(