Skip to content

Instantly share code, notes, and snippets.

@djmattyg007
djmattyg007 / gist:6b5e845ad1140c8a0fa66b64f953bf9a
Created April 7, 2016 11:20
Example of allowing management of individual systemd units with polkit
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.systemd1.manage-units") {
if (action.lookup("unit") == "myservice.service") {
var verb = action.lookup("verb");
if (verb == "start" || verb == "stop" || verb == "restart") {
return polkit.Result.YES;
}
}
}
});