Commit 9a57a1fd authored by Lennart Poettering's avatar Lennart Poettering
Browse files

systemctl: subscribe to changes of existing units/jobs

parent 1b91d3e8
...@@ -128,16 +128,17 @@ int main (string[] args) { ...@@ -128,16 +128,17 @@ int main (string[] args) {
" clear-jobs Cancel all jobs\n" + " clear-jobs Cancel all jobs\n" +
" load [NAME...] Load one or more units\n" + " load [NAME...] Load one or more units\n" +
" cancel [JOB...] Cancel one or more jobs\n" + " cancel [JOB...] Cancel one or more jobs\n" +
" start [NAME...] Start on or more units\n" + " start [NAME...] Start one or more units\n" +
" stop [NAME...] Stop on or more units\n" + " stop [NAME...] Stop one or more units\n" +
" enter [NAME] Start one unit and stop all others\n" + " restart [NAME...] Restart one or more units\n" +
" restart [NAME...] Restart on or more units\n" + " reload [NAME...] Reload one or more units\n" +
" reload [NAME...] Reload on or more units\n" + " isolate [NAME] Start one unit and stop all others\n" +
" monitor Monitor unit/job changes\n" + " monitor Monitor unit/job changes\n" +
" dump Dump server status\n" + " dump Dump server status\n" +
" snapshot [NAME] Create a snapshot\n" + " snapshot [NAME] Create a snapshot\n" +
" daemon-reload Reload daemon configuration\n" + " daemon-reload Reload daemon configuration\n" +
" daemon-reexecute Reexecute daemon\n" + " daemon-reexecute Reexecute daemon\n" +
" daemon-exit Ask the daemon to quit\n" +
" show-environment Dump environment\n" + " show-environment Dump environment\n" +
" set-environment [NAME=VALUE...] Set one or more environment variables\n" + " set-environment [NAME=VALUE...] Set one or more environment variables\n" +
" unset-environment [NAME...] Unset one or more environment variables\n"); " unset-environment [NAME...] Unset one or more environment variables\n");
...@@ -300,6 +301,15 @@ int main (string[] args) { ...@@ -300,6 +301,15 @@ int main (string[] args) {
manager.subscribe(); 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_new += monitor_on_unit_new;
manager.unit_removed += monitor_on_unit_removed; manager.unit_removed += monitor_on_unit_removed;
manager.job_new += monitor_on_job_new; manager.job_new += monitor_on_job_new;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment