summaryrefslogtreecommitdiff
path: root/src/systemctl.vala
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-06-01 19:47:46 +0200
committerLennart Poettering <lennart@poettering.net>2010-06-01 19:47:46 +0200
commitc87eba546a33ce7ecd66f0e3b61bdf55ae1389f0 (patch)
tree8309a2b911264e57f95dcb860983e5f8ea506c40 /src/systemctl.vala
parentf306f4c40d7004be058678ff3ed90c9c006767e0 (diff)
dbus: add simplified way to start an arbitrary unit in a single method call
Diffstat (limited to 'src/systemctl.vala')
-rw-r--r--src/systemctl.vala25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/systemctl.vala b/src/systemctl.vala
index e3e675f479..6cce93bec6 100644
--- a/src/systemctl.vala
+++ b/src/systemctl.vala
@@ -252,25 +252,17 @@ int main (string[] args) {
for (int i = 2; i < args.length; i++) {
- ObjectPath p = manager.load_unit(args[i]);
-
- Unit u = bus.get_object(
- "org.freedesktop.systemd1",
- p,
- "org.freedesktop.systemd1.Unit") as Unit;
-
string mode = replace ? "replace" : "fail";
-
ObjectPath j = null;
if (args[1] == "start")
- j = u.start(mode);
+ j = manager.start_unit(args[i], mode);
else if (args[1] == "stop")
- j = u.stop(mode);
+ j = manager.stop_unit(args[i], mode);
else if (args[1] == "restart")
- j = u.restart(mode);
+ j = manager.restart_unit(args[i], mode);
else if (args[1] == "reload")
- j = u.reload(mode);
+ j = manager.reload_unit(args[i], mode);
if (block)
jobs.append(j);
@@ -283,14 +275,7 @@ int main (string[] args) {
return 1;
}
- ObjectPath p = manager.load_unit(args[2]);
-
- Unit u = bus.get_object(
- "org.freedesktop.systemd1",
- p,
- "org.freedesktop.systemd1.Unit") as Unit;
-
- ObjectPath j = u.start("isolate");
+ ObjectPath j = manager.start_unit(args[2], "isolate");
if (block) {
manager.subscribe();