- case JOB_RELOAD_OR_START:
- if (unit_active_state(j->unit) == UNIT_ACTIVE) {
- j->type = JOB_RELOAD;
- r = unit_reload(j->unit);
- } else {
- j->type = JOB_START;
- r = unit_start(j->unit);
-
- if (r == -EBADR)
- r = 0;
- }
- break;
-
- case JOB_RESTART: {
- UnitActiveState t = unit_active_state(j->unit);
- if (t == UNIT_INACTIVE || t == UNIT_FAILED || t == UNIT_ACTIVATING) {
- j->type = JOB_START;
- r = unit_start(j->unit);
- } else
- r = unit_stop(j->unit);
- break;
- }
-
- case JOB_TRY_RESTART: {
- UnitActiveState t = unit_active_state(j->unit);
- if (t == UNIT_INACTIVE || t == UNIT_FAILED || t == UNIT_DEACTIVATING)
- r = -ENOEXEC;
- else if (t == UNIT_ACTIVATING) {
- j->type = JOB_START;
- r = unit_start(j->unit);
- } else {
- j->type = JOB_RESTART;
- r = unit_stop(j->unit);
- }
- break;
- }
-