squid.init 533 B

123456789101112131415161718192021222324252627282930313233343536
  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. exec sh $0 start
  10. ;;
  11. start)
  12. if [ ! -f /var/log/squid-cache.log ];then
  13. touch /var/log/squid-cache.log
  14. chown squid:squid /var/log/squid-cache.log
  15. fi
  16. if [ ! -d /var/squid/cache ];then
  17. mkdir -p /var/squid/cache
  18. chown squid:squid /var/squid/cache
  19. squid -z
  20. fi
  21. squid
  22. ;;
  23. stop)
  24. squid -k kill
  25. ;;
  26. restart)
  27. sh $0 stop
  28. sh $0 start
  29. ;;
  30. *)
  31. echo "usage: $0 {start | stop | restart}"
  32. exit 1
  33. esac
  34. exit $?