[systemd-devel] [PATCH 2/4] special shutdown targets will now cause manager to exit.

Lennart Poettering lennart at poettering.net
Fri Oct 1 06:54:00 PDT 2010


On Fri, 01.10.10 02:28, Gustavo Sverzut Barbieri (barbieri at profusion.mobi) wrote:

> +++ b/src/target.c
> @@ -172,6 +172,14 @@ static int target_start(Unit *u) {
>          assert(t->state == TARGET_DEAD);
>  
>          target_set_state(t, TARGET_ACTIVE);
> +
> +        if (unit_has_name(u, SPECIAL_REBOOT_TARGET))
> +                t->meta.manager->exit_code = MANAGER_REBOOT;
> +        else if (unit_has_name(u, SPECIAL_POWEROFF_TARGET))
> +                t->meta.manager->exit_code = MANAGER_POWEROFF;
> +        else if (unit_has_name(u, SPECIAL_HALT_TARGET))
> +                t->meta.manager->exit_code = MANAGER_HALT;
> +
>          return 0;
>  }

Please don't do this. Instead just place a normal service in these
targets that uses "systemctl" or "kill" to ask PID 1 to do the right
operation here...

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list