]> git.pld-linux.org Git - packages/anope.git/blame - anope.init
- unified tabs
[packages/anope.git] / anope.init
CommitLineData
f7a91a3d 1#!/bin/sh
2#
3# anope anope IRC Services
4#
5# chkconfig: 345 85 15
6# description: anope is an IRC services daemon.
7#
8
9# Source function library
10. /etc/rc.d/init.d/functions
11
12# Get network config
13. /etc/sysconfig/network
14
15# Get service config
16[ -f /etc/sysconfig/anope ] && . /etc/sysconfig/anope
17
18# Check that networking is up.
19if is_yes "${NETWORKING}"; then
20 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
21 msg_network_down anope
22 exit 1
23 fi
24else
25 exit 0
26fi
27
28start() {
29 daemon --user anope anope
30 RETVAL=$?
31 if [ $RETVAL -eq 0 ]; then
32 touch /var/lock/subsys/anope
33 fi
34 return $RETVAL
35}
36
37stop() {
38 killproc --pidfile /var/run/anope.pid anope
39 rm -f /var/lock/subsys/anope >/dev/null 2>&1
40}
41
42reload() {
43 # sending INT signal will make anope close all listening sockets and
44 # wait for client connections to terminate.
45 killproc --pidfile /var/run/anope.pid anope -HUP
46}
47
48RETVAL=0
49# See how we were called.
50case "$1" in
51 start)
52 # Check if the service is already running?
53 if [ ! -f /var/lock/subsys/anope ]; then
54 msg_starting anope
55 start
56 else
57 msg_already_running anope
58 fi
59 ;;
60 stop)
61 # Stop daemons.
62 if [ -f /var/lock/subsys/anope ]; then
63 msg_stopping anope
64 stop
65 else
66 msg_not_running anope
67 fi
68 ;;
69 status)
70 status anope
71 RETVAL=$?
72 ;;
73 restart)
74 if [ -f /var/lock/subsys/anope ]; then
75 msg_stopping anope
76 stop
77 msg_starting anope
78 start
79 RETVAL=$?
80 else
81 msg_not_running anope
82 msg_starting anope
83 start
84 fi
85 ;;
86 reload|graceful|force-reload)
87 if [ -f /var/lock/subsys/anope ]; then
88 msg_reloading anope
89 reload
90 RETVAL=$?
91 else
92 msg_not_running anope
93 RETVAL=7
94 fi
95 ;;
96 flush-logs)
97 if [ -f /var/lock/subsys/anope ]; then
98 nls "Rotating %s logs" anope
99 killproc --pidfile /var/run/anope.pid anope -HUP
100 RETVAL=$?
101 else
102 msg_not_running anope
103 RETVAL=7
104 fi
105 ;;
106 *)
107 msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|flush-logs|status}"
108 exit 3
109 ;;
110esac
111
112exit $RETVAL
This page took 0.068253 seconds and 4 git commands to generate.