asterisk.init 655 B

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