wz_init.sh 1.3 KB

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