mirror of
https://github.com/troglobit/finit.git
synced 2026-10-10 16:52:39 +07:00
Make sure to also reload all .conf files in /etc/finit.d/ when changing runlevel.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -290,6 +290,10 @@ void svc_runlevel(int newlevel)
|
||||
_d("Setting new runlevel --> %d <-- previous %d", runlevel, prevlevel);
|
||||
utmp_save(prevlevel, newlevel);
|
||||
|
||||
/* Make sure to reload all *.conf in /etc/finit.d/ */
|
||||
svc_mark_dynamic();
|
||||
parse_finit_d(rcsd);
|
||||
|
||||
_d("Stopping services services not allowed in new runlevel ...");
|
||||
for (svc = svc_iterator(1); svc; svc = svc_iterator(0)) {
|
||||
if (!ISSET(svc->runlevels, runlevel)) {
|
||||
@@ -300,6 +304,10 @@ void svc_runlevel(int newlevel)
|
||||
#endif
|
||||
svc_stop(svc);
|
||||
}
|
||||
|
||||
/* ... or disabled/removed services from /etc/finit.d/ */
|
||||
if (svc->mtime && svc->dirty != 0)
|
||||
svc_stop(svc);
|
||||
}
|
||||
|
||||
/* Prev runlevel services stopped, call hooks before starting new runlevel ... */
|
||||
@@ -322,6 +330,9 @@ void svc_runlevel(int newlevel)
|
||||
svc_dance(svc);
|
||||
}
|
||||
|
||||
/* Cleanup stale services */
|
||||
svc_cleanup();
|
||||
|
||||
if (0 == runlevel) {
|
||||
do_shutdown(SIGUSR2);
|
||||
return;
|
||||
@@ -935,10 +946,8 @@ void svc_reload_dynamic(void)
|
||||
|
||||
_d("Starting enabled/added services ...");
|
||||
for (svc = svc_iterator(1); svc; svc = svc_iterator(0)) {
|
||||
if (svc->mtime && svc->dirty > 0) {
|
||||
if (svc->mtime && svc->dirty > 0)
|
||||
svc_dance(svc);
|
||||
svc->dirty = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -957,6 +966,7 @@ void svc_cleanup(void)
|
||||
svc_stop(svc);
|
||||
svc_del(svc);
|
||||
}
|
||||
svc->dirty = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user