mirror of
https://github.com/troglobit/finit.git
synced 2026-10-15 10:29:35 +00:00
Let manual:yes run/tasks also end in state 'done'
This is a follow-up to #274, in which Andy pointed out that ending up in state 'stopped' was a bit confusing for manual:yes run/tasks. With the following change we let all run/tasks end in state 'done', yet still allow manual:yes ones to transition to 'ready' when the user calls `initctl start foo`. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
fbcd7d2384
commit
96257cc5c7
2 files changed
+5
-4
No files matched your search
+4
-4
@@ -1893,6 +1893,8 @@ restart:
|
||||
case SVC_DONE_STATE:
|
||||
if (svc_is_changed(svc))
|
||||
svc_set_state(svc, SVC_HALTED_STATE);
|
||||
if (svc_is_runtask(svc) && svc_is_manual(svc) && enabled)
|
||||
svc_set_state(svc, SVC_READY_STATE);
|
||||
break;
|
||||
|
||||
case SVC_STOPPING_STATE:
|
||||
@@ -1916,11 +1918,9 @@ restart:
|
||||
|
||||
case SVC_TYPE_TASK:
|
||||
case SVC_TYPE_RUN:
|
||||
if (svc->manual) {
|
||||
if (svc->manual)
|
||||
svc_stop(svc);
|
||||
svc_set_state(svc, SVC_HALTED_STATE);
|
||||
} else
|
||||
svc_set_state(svc, SVC_DONE_STATE);
|
||||
svc_set_state(svc, SVC_DONE_STATE);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -231,6 +231,7 @@ static inline int svc_is_sysv (svc_t *svc) { return svc && SVC_TYPE_SYSV
|
||||
static inline int svc_is_tty (svc_t *svc) { return svc && SVC_TYPE_TTY == svc->type; }
|
||||
static inline int svc_is_runtask (svc_t *svc) { return svc && (SVC_TYPE_RUNTASK & svc->type);}
|
||||
static inline int svc_is_forking (svc_t *svc) { return svc && svc->forking; }
|
||||
static inline int svc_is_manual (svc_t *svc) { return svc && svc->manual; }
|
||||
|
||||
static inline int svc_in_runlevel (svc_t *svc, int runlevel) { return svc && ISSET(svc->runlevels, runlevel); }
|
||||
static inline int svc_nohup (svc_t *svc) { return svc && (0 == svc->sighup || 0 != svc->args_dirty); }
|
||||
|
||||
Reference in new issue
Block a user