aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/init.d/rc.redhat.asterisk
blob: 09d5e269a2be765fa64f40ddffadce11ac76edcc (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
#!/bin/sh
#
# asterisk           This shell script takes care of starting and stopping
#               asterisk (printer daemon).
#
# chkconfig: 2345 60 60
# description: asterisk is the print daemon required for lpr to work properly. \
#   It is basically a server that arbitrates print jobs to printer(s).
# processname: asterisk
# config: /etc/printcap

# Source function library.
. /etc/rc.d/init.d/functions

[ -f /usr/sbin/asterisk ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting asterisk: "
        daemon safe_asterisk
	RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down asterisk: "
	killproc asterisk
	RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/asterisk
        ;;
  status)
	status asterisk
	RETVAL=$?
	;;
  restart|reload)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
        echo "Usage: asterisk {start|stop|restart|reload|status}"
        exit 1
esac

exit $RETVAL