aboutsummaryrefslogtreecommitdiff
path: root/initd/main.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-08-24 16:59:28 +0200
committerDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-08-24 21:17:31 +0200
commit066efaa33e7641d378ac4d8a1419a525df6f70d2 (patch)
tree0ad5b67757d876cd9db6fe58de796a44f57d78c9 /initd/main.c
parent2d54b32d2406de4ad624c011bf4b30ed45dabdaf (diff)
initd: automatically do a shutdown/reboot when the target is completed
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'initd/main.c')
-rw-r--r--initd/main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/initd/main.c b/initd/main.c
index 08e314f..b50c09c 100644
--- a/initd/main.c
+++ b/initd/main.c
@@ -103,7 +103,13 @@ void target_completed(int target)
if (ti_sock == -1)
ti_sock = mksock(INITSOCK, SOCK_FLAG_ROOT_ONLY);
break;
- default:
+ case TGT_SHUTDOWN:
+ for (;;)
+ reboot(RB_POWER_OFF);
+ break;
+ case TGT_REBOOT:
+ for (;;)
+ reboot(RB_AUTOBOOT);
break;
}
}