[BusyBox] patch to add 'reboot' to inittab

Williams, Kevin M. kevin.m.williams at marconi.com
Mon Nov 5 09:05:23 UTC 2001


This patch for init.c adds 'reboot' as a possible action for inittab. Now
when I add the following to inittab:

::wait:-/path/to/myapp.exe
::reboot:-/path/to/myapp.exe

It starts myapp.exe at startup, and if it ever exits, the entire system
reboots. For my embedded system, operating remotely and with no keyboard
input, this is a good thing.  

Kevin

--- init.from.cvs.c	Mon Nov  5 10:38:42 2001
+++ init.c	Mon Nov  5 10:36:03 2001
@@ -136,7 +137,8 @@
 	WAIT,
 	ONCE,
 	CTRLALTDEL,
-	SHUTDOWN
+	SHUTDOWN,
+	REBOOT
 } initActionEnum;
 
 /* A mapping between "inittab" action name strings and action type codes.
*/
@@ -153,6 +155,7 @@
 	{"once", ONCE},
 	{"ctrlaltdel", CTRLALTDEL},
 	{"shutdown", SHUTDOWN},
+	{"reboot", REBOOT},
 	{0, 0}
 };
 
@@ -1020,13 +1007,17 @@
 					a->pid = run(a->process, a->console,
TRUE);
 					break;
 					/* silence the compiler's incessant
whining */
+				case REBOOT:
+					reboot_signal(SIGTERM);
 				default:
 					break;
 				}





More information about the busybox mailing list