nginx.init 545 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. #PKG nginx
  3. #INIT 70
  4. . /etc/rc.conf
  5. case $1 in
  6. autostop) ;;
  7. autostart)
  8. test x"${nginx:-NO}" = x"NO" && exit 0
  9. test x"$nginx" = x"DAEMON" && test -x /bin/mksh && exec mksh -T- $0 start
  10. exec sh $0 start
  11. ;;
  12. start)
  13. [ -d /var/lib/nginx ] || mkdir -p /var/lib/nginx
  14. [ -d /var/log/nginx ] || mkdir -p /var/log/nginx
  15. [ -d /var/lock/nginx ] || mkdir -p /var/lock/nginx
  16. /usr/sbin/nginx
  17. ;;
  18. stop)
  19. kill $(pgrep -f /usr/sbin/nginx)
  20. ;;
  21. restart)
  22. sh $0 stop
  23. sh $0 start
  24. ;;
  25. *)
  26. echo "usage: $0 {start | stop | restart}"
  27. ;;
  28. esac
  29. exit $?