]> git.pld-linux.org Git - packages/cassandra-bin.git/blob - cassandra.init
- Release 1. Adapterized, cleaning. Works enough good for me.
[packages/cassandra-bin.git] / cassandra.init
1 #!/bin/sh
2 #
3 # cassandra     Cassandra 
4 #
5 # chkconfig:    345 84 25
6 #
7 # description:  Cassandra database node
8 #
9 # processname:  cassandra
10
11 # Source function library
12 . /etc/rc.d/init.d/functions
13
14 # Get network config
15 . /etc/sysconfig/network
16
17
18 # Get service config - may override defaults
19 # [ -f /etc/sysconfig/cassandra ] && . /etc/sysconfig/cassandra
20
21 # Check that networking is up.
22 if is_yes "${NETWORKING}"; then
23         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
24                 msg_network_down cassandra
25                 exit 1
26         fi
27 else
28         exit 0
29 fi
30
31 test -x /usr/sbin/cassandra  || exit 0
32
33 start() {
34         # Check if the service is already running?
35         if [ ! -f /var/lock/subsys/cassandra ]; then
36                 msg_starting cassandra
37                 daemon /usr/sbin/cassandra  -p /var/run/cassandra.pid  
38                 RETVAL=$?
39                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cassandra
40         else
41                 msg_already_running cassandra
42         fi
43 }
44
45
46 stop() {
47         if [ -f /var/lock/subsys/cassandra ]; then
48                 # Stop daemons.
49                 msg_stopping cassandra
50                 killproc --pidfile /var/run/cassandra.pid cassandra -TERM
51                 rm -f /var/lock/subsys/cassandra
52         else
53                 msg_not_running cassandra
54         fi
55 }
56
57 condrestart() {
58         if [ -f /var/lock/subsys/cassandra ]; then
59                 stop
60                 start
61         else
62                 msg_not_running cassandra
63                 RETVAL=$1
64         fi
65 }
66
67 RETVAL=0
68 # See how we were called.
69 case "$1" in
70   start)
71         start
72         ;;
73   stop)
74         stop
75         ;;
76   restart)
77         stop
78         start
79         ;;
80   try-restart)
81         condrestart 0
82         ;;
83   force-reload)
84         condrestart 7
85         ;;
86   status) 
87         # Does not work with /usr/sbin/cassandra for some reason
88         status cassandra
89         ;;
90   *)
91         # msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
92         msg_usage "$0 {start|stop|restart|try-restart|force-reload}"
93         exit 3
94 esac
95
96 exit $RETVAL
This page took 0.066832 seconds and 4 git commands to generate.