]> git.pld-linux.org Git - packages/atheme.git/blame - atheme.init
- rc-scripts dep for daemon() --pidfile
[packages/atheme.git] / atheme.init
CommitLineData
3733a855 1#!/bin/sh
2#
3# atheme atheme IRC Services
4#
5# chkconfig: 345 85 15
6# description: atheme 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/atheme ] && . /etc/sysconfig/atheme
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 atheme
22 exit 1
23 fi
24else
25 exit 0
26fi
27
28start() {
cf81b6cd 29 daemon --user atheme atheme
3733a855 30 RETVAL=$?
31 if [ $RETVAL -eq 0 ]; then
32 touch /var/lock/subsys/atheme
33 fi
34 return $RETVAL
35}
36
37stop() {
38 killproc --pidfile /var/run/atheme.pid atheme
39 rm -f /var/lock/subsys/atheme >/dev/null 2>&1
40}
41
42reload() {
43 # sending INT signal will make atheme close all listening sockets and
44 # wait for client connections to terminate.
45 killproc --pidfile /var/run/atheme.pid atheme -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/atheme ]; then
54 msg_starting atheme
55 start
56 else
57 msg_already_running atheme
58 fi
59 ;;
60 stop)
61 # Stop daemons.
62 if [ -f /var/lock/subsys/atheme ]; then
63 msg_stopping atheme
64 stop
65 else
66 msg_not_running atheme
67 fi
68 ;;
69 status)
70 status atheme
71 RETVAL=$?
72 ;;
73 restart)
74 if [ -f /var/lock/subsys/atheme ]; then
75 msg_stopping atheme
76 stop
77 msg_starting atheme
78 start
79 RETVAL=$?
80 else
81 msg_not_running atheme
82 msg_starting atheme
83 start
84 fi
85 ;;
86 reload|graceful|force-reload)
87 if [ -f /var/lock/subsys/atheme ]; then
88 msg_reloading atheme
89 reload
90 RETVAL=$?
91 else
92 msg_not_running atheme
93 RETVAL=7
94 fi
95 ;;
96 flush-logs)
97 if [ -f /var/lock/subsys/atheme ]; then
98 nls "Rotating %s logs" atheme
99 killproc --pidfile /var/run/atheme.pid atheme -HUP
100 RETVAL=$?
101 else
102 msg_not_running atheme
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.08061 seconds and 4 git commands to generate.