summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-extended/glusterfs/files/glusterd-ovp
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openstack/recipes-extended/glusterfs/files/glusterd-ovp')
-rw-r--r--meta-openstack/recipes-extended/glusterfs/files/glusterd-ovp93
1 files changed, 93 insertions, 0 deletions
diff --git a/meta-openstack/recipes-extended/glusterfs/files/glusterd-ovp b/meta-openstack/recipes-extended/glusterfs/files/glusterd-ovp
new file mode 100644
index 0000000..c020928
--- /dev/null
+++ b/meta-openstack/recipes-extended/glusterfs/files/glusterd-ovp
@@ -0,0 +1,93 @@
1#!/bin/bash
2#
3# chkconfig: 35 20 80
4# description: Gluster File System service for volume management
5#
6
7# Get function from functions library
8. /etc/init.d/functions
9
10BASE=glusterd
11PIDFILE=/var/run/$BASE.pid
12PID=`test -f $PIDFILE && cat $PIDFILE`
13GLUSTERFSD=glusterfsd
14GLUSTERFS=glusterfs
15GLUSTERD_BIN=/usr/sbin/$BASE
16GLUSTERD_OPTS="--pid-file=$PIDFILE"
17GLUSTERD="$GLUSTERD_BIN $GLUSTERD_OPTS"
18RETVAL=0
19
20# Start the service $BASE
21start()
22{
23 # Force creation of the log directory even on a tmpfs /var/log.
24 mkdir -p /var/log/glusterfs
25
26 start-stop-daemon --stop --test --quiet --pidfile $PIDFILE
27 status=$?
28 if [ $status -eq 0 ]; then
29 echo "glusterd service is already running with pid $PID"
30 exit 1
31 else
32 echo -n $"Starting $BASE:"
33 start-stop-daemon --start --pidfile $PIDFILE \
34 --exec $GLUSTERD_BIN -- "$GLUSTERD_OPTS"
35 RETVAL=$?
36 echo
37 [ $RETVAL -ne 0 ] && exit $RETVAL
38 fi
39}
40
41# Stop the service $BASE
42stop()
43{
44 echo -n $"Stopping $BASE:"
45 start-stop-daemon --stop --test --quiet --pidfile $PIDFILE
46 status=$?
47 if [ $status -eq 0 ]; then
48 start-stop-daemon --stop --quiet --pidfile $PIDFILE
49 [ -w $PIDFILE ] && rm -f $PIDFILE
50 else
51 start-stop-daemon --stop --quiet --name $BASE
52 fi
53
54 echo
55 pidof -c -o %PPID -x $GLUSTERFSD &> /dev/null
56 [ $? -eq 0 ] && start-stop-daemon --stop --quiet --name $GLUSTERFSD
57
58 #pidof -c -o %PPID -x $GLUSTERFS &> /dev/null
59 #[ $? -eq 0 ] && start-stop-daemon --stop --quiet --name $GLUSTERFS
60
61 if [ -f /etc/glusterd/nfs/run/nfs.pid ] ;then
62 pid=`cat /etc/glusterd/nfs/run/nfs.pid`;
63 cmd=`ps -p $pid -o comm=`
64
65 if [ $cmd == "glusterfs" ]; then
66 start-stop-daemon --stop --quiet \
67 --pidfile /etc/glusterd/nfs/run/nfs.pid
68 fi
69 fi
70}
71
72
73### service arguments ###
74case $1 in
75 start)
76 start
77 ;;
78 stop)
79 stop
80 ;;
81 status)
82 status $BASE
83 ;;
84 restart | force-reload)
85 $0 stop
86 $0 start
87 ;;
88 *)
89 echo $"Usage: $0 {start|stop|status|restart}."
90 exit 1
91esac
92
93exit 0