summaryrefslogtreecommitdiffstats
path: root/openwrt/package/asterisk/files/asterisk.init
blob: 698c3dfa825a69130f892d825a7f880ec477f0a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

DEFAULT=/etc/default/asterisk
OPTIONS=""
[ -f $DEFAULT ] && . $DEFAULT
[ "$ENABLE_ASTERISK" = "yes" ] || exit 0

case $1 in
 start)
  [ -d /var/run ] || mkdir -p /var/run
  [ -d /var/log/asterisk ] || mkdir -p /var/log/asterisk
  [ -d /var/spool/asterisk ] || mkdir -p /var/spool/asterisk
  /usr/sbin/asterisk $OPTIONS
  ;;
 stop)
  [ -f /var/run/asterisk.pid ] && kill $(cat /var/run/asterisk.pid) >/dev/null 2>&1
  ;;
 *)
  echo "usage: $0 (start|stop)"
  exit 1
esac

exit $?