wz_init.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. set -x
  15. echo "welcome to wz_init.sh"
  16. echo "PID $$"
  17. echo '
  18. __ ________ __ __ _____ _ _ _____
  19. \ \ / |___ / | \/ |_ _| \ | |_ _|
  20. \ \ /\ / / / / | \ / | | | | \| | | |
  21. \ \/ \/ / / / | |\/| | | | | . ` | | |
  22. \ /\ / / /__ | | | |_| |_| |\ |_| |_
  23. \/ \/ /_____| |_| |_|_____|_| \_|_____|
  24. ______
  25. |______|
  26. '
  27. # Start all init scripts in /etc/init.d
  28. # executing them in numerical order.
  29. #
  30. for i in /opt/wz_mini/etc/init.d/S??* ;do
  31. # Ignore dangling symlinks (if any).
  32. [ ! -f "$i" ] && continue
  33. case "$i" in
  34. *.sh)
  35. # Source shell script for speed.
  36. (
  37. trap - INT QUIT TSTP
  38. set start
  39. . $i
  40. )
  41. ;;
  42. *)
  43. # No sh extension, so fork subprocess.
  44. $i start
  45. ;;
  46. esac
  47. done
  48. /linuxrc