squid.init 608 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. #PKG squid
  3. #INIT 70
  4. . /etc/rc.conf
  5. case $1 in
  6. autostop) ;;
  7. autostart)
  8. test x"${squid:-NO}" = x"NO" && exit 0
  9. test x"$squid" = x"DAEMON" && test -x /bin/mksh && exec mksh -T- $0 start
  10. exec sh $0 start
  11. ;;
  12. start)
  13. if [ ! -f /var/log/squid-cache.log ];then
  14. touch /var/log/squid-cache.log
  15. chown squid:squid /var/log/squid-cache.log
  16. fi
  17. if [ ! -d /var/squid/cache ];then
  18. mkdir -p /var/squid/cache
  19. chown squid:squid /var/squid/cache
  20. squid -z
  21. fi
  22. squid
  23. ;;
  24. stop)
  25. squid -k kill
  26. ;;
  27. restart)
  28. sh $0 stop
  29. sh $0 start
  30. ;;
  31. *)
  32. echo "usage: $0 {start | stop | restart}"
  33. exit 1
  34. esac
  35. exit $?