cups.init 578 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. #PKG cups
  3. #INIT 60
  4. . /etc/rc.conf
  5. case $1 in
  6. autostop) ;;
  7. autostart)
  8. test x"${cups:-NO}" = x"NO" && exit 0
  9. test x"$cups" = x"DAEMON" && test -x /bin/mksh && exec mksh -T- $0 start
  10. exec sh $0 start
  11. ;;
  12. start)
  13. [ -d /var/cache/cups ] || mkdir -p /var/cache/cups
  14. [ -d /var/cups ] || mkdir -p /var/cups/tmp
  15. [ -d /var/cups/spool/cups/tmp ] || mkdir -p /var/cups/spool/cups/tmp
  16. /usr/sbin/cupsd -c /etc/cups/cupsd.conf
  17. ;;
  18. stop)
  19. kill $(pgrep -f /usr/sbin/cupsd)
  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 $?