require 'socket'
-def do_cmd(*cmd)
- ctl = UNIXSocket.open('/run/initctl')
- ctl.puts(cmd.join(' '))
- puts(ctl.readline.chomp)
- exit
-end
-
-
# These are hashes
-
$daemons = {}
$daemonCmds = {}
# Needed to prevent respawning during a reboot...
-
$shuttingDown = false
-# Here we do some process monitoring...
+def launch(id, cmd)
+ puts('Starting %s...' % id)
+ pid = fork do
+ Process.setsid()
+ exec(*cmd)
+ end
+ $daemons[id] = pid
+ $daemonCmds[id] = cmd
+end
+
+
+# Here we do some process monitoring...
Signal.trap(:SIGCHLD) do
loop do
begin
end
-def launch(id, cmd)
- puts('Starting %s...' % id)
- pid = fork do
- Process.setsid()
- exec(*cmd)
- end
- $daemons[id] = pid
- $daemonCmds[id] = cmd
-end
-
-
def init
puts('*** init-ng v1.0.0 starting...')
end
-# This shows the one of the hazards of coding this in Ruby...
+def do_cmd(*cmd)
+ ctl = UNIXSocket.open('/run/initctl')
+ ctl.puts(cmd.join(' '))
+ puts(ctl.readline.chomp)
+ exit
+end
+
+# This shows the one of the hazards of coding this in Ruby...
def sys_reboot(cmd)
# LINUX_REBOOT_CMD_POWER_OFF == 0x4321FEDC
# LINUX_REBOOT_CMD_RESTART == 0x01234567