summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-05-22 04:39:37 +0200
committerLennart Poettering <lennart@poettering.net>2010-05-22 04:39:37 +0200
commit9a57a1fdd6491bb319d5ae59b505fa224b873ccf (patch)
tree6e28a9d9112fe069fe20f78c238dd11056124bd5 /src
parent1b91d3e8f402829f336daa5f768e768aede373da (diff)
systemctl: subscribe to changes of existing units/jobs
Diffstat (limited to 'src')
-rw-r--r--src/systemctl.vala20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/systemctl.vala b/src/systemctl.vala
index e1e8a0c832..e3e675f479 100644
--- a/src/systemctl.vala
+++ b/src/systemctl.vala
@@ -128,16 +128,17 @@ int main (string[] args) {
" clear-jobs Cancel all jobs\n" +
" load [NAME...] Load one or more units\n" +
" cancel [JOB...] Cancel one or more jobs\n" +
- " start [NAME...] Start on or more units\n" +
- " stop [NAME...] Stop on or more units\n" +
- " enter [NAME] Start one unit and stop all others\n" +
- " restart [NAME...] Restart on or more units\n" +
- " reload [NAME...] Reload on or more units\n" +
+ " start [NAME...] Start one or more units\n" +
+ " stop [NAME...] Stop one or more units\n" +
+ " restart [NAME...] Restart one or more units\n" +
+ " reload [NAME...] Reload one or more units\n" +
+ " isolate [NAME] Start one unit and stop all others\n" +
" monitor Monitor unit/job changes\n" +
" dump Dump server status\n" +
" snapshot [NAME] Create a snapshot\n" +
" daemon-reload Reload daemon configuration\n" +
" daemon-reexecute Reexecute daemon\n" +
+ " daemon-exit Ask the daemon to quit\n" +
" show-environment Dump environment\n" +
" set-environment [NAME=VALUE...] Set one or more environment variables\n" +
" unset-environment [NAME...] Unset one or more environment variables\n");
@@ -300,6 +301,15 @@ int main (string[] args) {
manager.subscribe();
+ var unit_list = manager.list_units();
+
+ foreach (var i in unit_list) {
+ monitor_on_unit_new(i.id, i.unit_path);
+
+ if (i.job_id != 0)
+ monitor_on_job_new(i.job_id, i.job_path);
+ }
+
manager.unit_new += monitor_on_unit_new;
manager.unit_removed += monitor_on_unit_removed;
manager.job_new += monitor_on_job_new;