wz_init.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/sh
  2. #init.d/ = early boot, before inittab is run
  3. #rc.d/ = runs after /linuxrc, but before app_init.sh
  4. #network.d/ runs after app_init.sh, and after wlan hw is ready
  5. #rc.local.d/ = runs after app_init.sh and network has acquired an address
  6. ###This file is run by switch_root, from the initramfs in the kernel.
  7. LOG_NAME=/opt/wz_mini/log/wz_init
  8. if [[ -e $LOG_NAME.log || -L $LOG_NAME.log ]] ; then
  9. i=0
  10. while [[ -e $LOG_NAME.log.$i || -L $LOG_NAME.log.$i ]] ; do
  11. let i++
  12. done
  13. mv $LOG_NAME.log $LOG_NAME.log.$i
  14. LOG_NAME=$LOG_NAME
  15. fi
  16. touch -- "$LOG_NAME".log
  17. exec 1> $LOG_NAME.log 2>&1
  18. echo "welcome to wz_init.sh"
  19. echo "PID $$"
  20. echo '
  21. __ ________ __ __ _____ _ _ _____
  22. \ \ / |___ / | \/ |_ _| \ | |_ _|
  23. \ \ /\ / / / / | \ / | | | | \| | | |
  24. \ \/ \/ / / / | |\/| | | | | . ` | | |
  25. \ /\ / / /__ | | | |_| |_| |\ |_| |_
  26. \/ \/ /_____| |_| |_|_____|_| \_|_____|
  27. ______
  28. |______|
  29. '
  30. # Start all init scripts in /etc/init.d
  31. # executing them in numerical order.
  32. #
  33. for i in /opt/wz_mini/etc/init.d/S??* ;do
  34. # Ignore dangling symlinks (if any).
  35. [ ! -f "$i" ] && continue
  36. case "$i" in
  37. *.sh)
  38. # Source shell script for speed.
  39. (
  40. trap - INT QUIT TSTP
  41. set start
  42. . $i
  43. )
  44. ;;
  45. *)
  46. # No sh extension, so fork subprocess.
  47. $i start
  48. ;;
  49. esac
  50. done
  51. /linuxrc