summaryrefslogtreecommitdiff
path: root/recipes/callweaver/files/init
blob: 02cc3c1b0e58a4e3542d6fc019e31359e5af321e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#! /bin/sh 
#
# This is an init script for openembedded
# Copy it to /etc/init.d/callweaver and type
# > update-rc.d callweaver defaults 60
#
callweaver=/usr/sbin/callweaver
pidfile=/var/run/callweaver/callweaver.pid

test -x "$callweaver" || exit 0

case "$1" in
  start)
    echo -n "Starting Callweaver"
    start-stop-daemon --start --quiet --exec $callweaver -- -npq
    echo "."
    ;;
  stop)
    echo -n "Stopping Callweaver"
    $callweaver -rx "stop gracefully"
    sleep 4
    if [ -f $pidfile ]; then
      start-stop-daemon --stop --quiet --pidfile $pidfile
    fi
    echo "."
    ;;
  force-stop)
    echo -n "Stopping Callweaver"
    $callweaver -rx "stop now"
    sleep 2
    if [ -f $pidfile ]; then
      start-stop-daemon --stop --quiet --pidfile $pidfile
    fi
    echo "."
    ;;
  restart)
    echo -n "Restarting Callweaver"
    if [ -f $pidfile ]; then
      $callweaver -rx "restart gracefully"
      sleep 2
    else
      start-stop-daemon --start --quiet --exec $callweaver -- -npq
    fi
    ;;
  force-restart)
    echo -n "Forcibly Restarting Callweaver"
    if [ -f $pidfile ]; then
      $callweaver -rx "restart now"
      sleep 2
    else
      start-stop-daemon --start --quiet --exec $callweaver -- -npq
    fi
    ;;
  reload)
    echo -n "Reloading Callweaver Configuration"
    if [ -f $pidfile ]; then
      $callweaver -rx "reload"
    else
      start-stop-daemon --start --quiet --exec $callweaver -- -npq
    fi
    echo "."
    ;;
  logger-reload)
#    echo -n "Restating Callweaver Logger"
    if [ -f $pidfile ]; then
      $callweaver -rx "logger reload"
    fi
#    echo "."
    ;;
  *)
    echo "Usage: /etc/init.d/callweaver {start|stop|force-stop|restart|force-restart|reload|logger-reload}"
    exit 1
esac

exit 0