entrypoint.sh 616 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. set -e
  3. init()
  4. {
  5. /usr/sbin/sshd
  6. }
  7. loadStart()
  8. {
  9. dir=/entrypoint/
  10. loop=$(ls -l $dir |awk '{print $9}')
  11. for i in $loop
  12. do
  13. source $dir$i
  14. done
  15. }
  16. start()
  17. {
  18. loadStart
  19. if [[ $1 =~ "-" ]]; then
  20. OLD_IFS="$IFS"
  21. IFS="-"
  22. arr=($1)
  23. IFS="$OLD_IFS"
  24. start="start_${arr[0]}"
  25. echo $start
  26. eval $start ${arr[1]}
  27. else
  28. start="start_$1"
  29. echo $start
  30. eval $start
  31. fi
  32. }
  33. init
  34. if [ "$1" != "sh" ]; then
  35. for args in $@
  36. do
  37. start $args
  38. echo -e "\n"
  39. done
  40. fi
  41. jps
  42. netstat -apn
  43. exec sh