/* Special setting for all SysV services */
s->valid_no_process = true;
+ /* Don't timeout special services during boot (like fsck) */
+ if (s->sysv_runlevels && !chars_intersect("12345", s->sysv_runlevels))
+ s->timeout_usec = -1;
+
u->meta.load_state = UNIT_LOADED;
r = 0;
RATELIMIT_INIT(s->ratelimit, 10*USEC_PER_SEC, 5);
}
+static int service_verify(Service *s) {
+ assert(s);
+
+ if (UNIT(s)->meta.load_state != UNIT_LOADED)
+ return 0;
+
+ if (!s->exec_command[SERVICE_EXEC_START]) {
+ log_error("%s lacks ExecStart setting. Refusing.", unit_id(UNIT(s)));
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static int service_load(Unit *u) {
int r;
Service *s = SERVICE(u);
return r;
}
- return 0;
+ return service_verify(s);
}
static void service_dump(Unit *u, FILE *f, const char *prefix) {
int r;
assert(s);
+ service_enter_dead(s, true, false);
+
if ((r = manager_add_job(UNIT(s)->meta.manager, JOB_START, UNIT(s), JOB_FAIL, false, NULL)) < 0)
goto fail;
log_debug("%s scheduled restart job.", unit_id(UNIT(s)));
- service_enter_dead(s, true, false);
return;
fail:
return state_translation_table[SERVICE(u)->state];
}
+static const char *service_sub_state_to_string(Unit *u) {
+ assert(u);
+
+ return service_state_to_string(SERVICE(u)->state);
+}
+
static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
Service *s = SERVICE(u);
bool success;
.can_reload = service_can_reload,
.active_state = service_active_state,
+ .sub_state_to_string = service_sub_state_to_string,
.sigchld_event = service_sigchld_event,
.timer_event = service_timer_event,