1 /* tinyhalt 1.0 - small forerunner Author: Kees J. Bot
3 * Disk space on the root file system is a scarce resource. This little
4 * program sits in /sbin. It normally calls the real halt/reboot, but if
5 * that isn't available then it simply calls reboot(). Can't do any logging
16 int main(int argc
, char **argv
)
20 char *reboot_code
= "delay; boot";
22 /* Try to run the real McCoy. */
24 execv("/usr/sbin/halt", argv
);
26 execv("/usr/bin/halt", argv
);
29 if ((prog
= strrchr(*argv
,'/')) == nil
) prog
= argv
[0]; else prog
++;
31 sleep(1); /* Not too fast. */
32 signal(SIGHUP
, SIG_IGN
);
33 signal(SIGTERM
, SIG_IGN
);
38 reboot(strcmp(prog
, "reboot") == 0 ? RBT_MONITOR
: RBT_HALT
,
39 reboot_code
, strlen(reboot_code
));
41 write(2, "reboot call failed\n", 19);