+ for (int i = 2; i < args.length; i++)
+ manager.load_unit(args[i]);
+
+ } else if (args[1] == "cancel") {
+
+ if (args.length < 3) {
+ stderr.printf("Missing argument.\n");
+ return 1;
+ }
+
+ for (int i = 2; i < args.length; i++) {
+ uint32 id;
+
+ if (args[i].scanf("%u", out id) != 1) {
+ stderr.printf("Failed to parse argument.\n");
+ return 1;
+ }
+
+ ObjectPath p = manager.get_job(id);
+
+ Job j = bus.get_object (
+ "org.freedesktop.systemd1",
+ p,
+ "org.freedesktop.systemd1.Job") as Job;
+
+ j.cancel();
+ }
+
+ } else if (args[1] == "start" ||
+ args[1] == "stop" ||
+ args[1] == "reload" ||
+ args[1] == "restart") {
+
+ if (args.length < 3) {
+ stderr.printf("Missing argument.\n");
+ return 1;
+ }
+
+ for (int i = 2; i < args.length; i++) {
+
+ ObjectPath p = manager.get_unit(args[i]);
+
+ Unit u = bus.get_object(
+ "org.freedesktop.systemd1",
+ p,
+ "org.freedesktop.systemd1.Unit") as Unit;
+
+ string mode = replace ? "replace" : "fail";
+
+ if (args[1] == "start")
+ u.start(mode);
+ else if (args[1] == "stop")
+ u.stop(mode);
+ else if (args[1] == "restart")
+ u.restart(mode);
+ else if (args[1] == "reload")
+ u.reload(mode);
+ }
+
+ } else if (args[1] == "monitor") {
+
+ manager.subscribe();
+
+ manager.unit_new += on_unit_new;
+ manager.unit_removed += on_unit_removed;
+ manager.job_new += on_job_new;
+ manager.job_removed += on_job_removed;
+
+ MainLoop l = new MainLoop();
+ l.run();
+
+ } else if (args[1] == "dump")
+ stdout.puts(manager.dump());
+ else {