]> git.pld-linux.org Git - packages/asterisk.git/blame - asterisk.init
- init scripts for asterisk
[packages/asterisk.git] / asterisk.init
CommitLineData
68da8345
PG
1#!/bin/sh
2#
3# asterix This shell script takes care of starting and stopping
4# Asterisk PBX
5#
6# chkconfig: 345 90 25
7#
8# description: Asterisk is an Open Source PBX and telephony development platform that
9# can both replace a conventional PBX and act as a platform for
10# developing custom telephony applications for delivering dynamic
11# content over a telephone similarly to how one can deliver dynamic
12# content through a web browser using CGI and a web server.
13#
14# pidfile: /var/run/asterisk.pid
15# config: /etc/asterisk/asterisk.conf
16
17
18# Source function library
19. /etc/rc.d/init.d/functions
20
21# Get network config
22. /etc/sysconfig/network
23
24# Get service config
25[ -f /etc/sysconfig/asterisk ] && . /etc/sysconfig/asterisk
26
27# Check that networking is up.
28if is_no "${NETWORKING}"; then
29 msg_network_down Asterisk
30 exit 1
31fi
32
33# Sanity check
34[ -f /etc/asterisk/asterisk.conf ] || exit 0
35
36# See how we were called.
37case "$1" in
38 start)
39 # Check if the service is already running?
40 if [ ! -f /var/lock/subsys/asterisk ]; then
41 msg_starting Asterisk
42 busy
43 daemon $SERVICE_RUN_NICE_LEVEL asterisk $ASTERISK_OPTS
44 RETVAL=$?
45 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
46 else
47 msg_already_running Asterisk
48 fi
49 ;;
50 stop)
51 # Stop daemons.
52 if [ -f /var/lock/subsys/asterisk ]; then
53 msg_stopping Asterisk
54 killproc asterisk
55 rm -f /var/lock/subsys/asterisk >/dev/null 2>&1
56 else
57 msg_not_running Asterisk
58 exit 1
59 fi
60 ;;
61 restart)
62 $0 stop
63 $0 start
64 ;;
65 reload)
66 # Should be some better way...
67 $0 restart
68# if [ -f /var/lock/subsys/ ]; then
69# msg_reloading Asterisk
70# busy
71# ok
72# else
73# msg_not_running Asterisk
74# exit 1
75# fi
76 ;;
77 status)
78 status asterisk
79 exit $?
80 ;;
81 *)
82 msg_usage "$0 {start|stop|status|restart|reload}"
83 exit 1
84esac
85
86exit $RETVAL
This page took 0.046763 seconds and 4 git commands to generate.