 : shutdown ( -- ) shutdown-hook get call ;
 
 MAIN: boot
+

SYMBOL: shutdown-hook
SYMBOL: networking-hook

: reload-raptor-config ( -- )
  "/etc/raptor/config.factor" run-file
  "/etc/raptor/cronjobs.factor" run-file ;

! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

USING: sequences unix ;

: start-service ( name -- ) "/etc/init.d/" swap " start" 3append system drop ;
: stop-service  ( name -- ) "/etc/init.d/" swap " stop"  3append system drop ;

! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

: fork-exec-wait ( pathname args -- )
  fork dup 0 = [ drop exec drop ] [ 2nip wait-for-pid ] if ;

! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

: respawn ( pathname args -- ) [ fork-exec-wait ] [ respawn ] 2bi ;

: start-gettys ( -- )
  [ "/sbin/getty" { "getty" "38400" "tty5" } respawn ] in-thread
  [ "/sbin/getty" { "getty" "38400" "tty6" } respawn ] in-thread ;

! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



USING: kernel parser namespaces threads sequences unix unix.process
       combinators.cleave bake ;

IN: raptor

