Whamcloud - gitweb
LU-1346 contrib: fix libcfs_cleanup script
[fs/lustre-release.git] / lustre / scripts / llite-group.sh
1 #!/bin/sh
2 #
3 # llite-group.sh : Cluster Manager service script for Lustre
4 #
5 # This must be named llite-<group>.sh, where group is the device 
6 # group that is being managed by the cluster manager service.
7 #
8
9 set -e
10 set -vx
11
12 [ -f ${LUSTRE_CFG:=/etc/lustre/lustre.cfg} ] && . ${LUSTRE_CFG}
13
14 LDAPURL=${LDAPURL:-ldap://localhost}
15 CONFIG=${CONFIG:-test23}
16
17 LACTIVE=${LACTIVE:-/usr/sbin/lactive}
18 LCONF=${LCONF:-/usr/sbin/lconf}
19
20 group=`basename $0 .sh| cut -d- -f2`
21 confopt="--ldapurl $LDAPURL --config $CONFIG"
22
23 [ -z "$group" ] && exit 0
24
25 node=`hostname -s`
26
27 [ -d ${STATUS_DIR:=/var/lustre} ] || mkdir -p $STATUS_DIR
28
29 start() {
30         echo -n "Starting $SERVICE: "
31         python2 $LACTIVE $confopt --group $group --active $node
32         python2 $LCONF -v $confopt
33         RETVAL=$?
34         echo done
35 }
36
37 stop() {
38         echo -n "Shutting down $SERVICE: "
39         python2 $LCONF -v --cleanup --force --failover $confopt
40         RETVAL=$?
41         echo done
42 }
43
44 status() {
45         RETVAL=0
46 }
47
48
49 case "$1" in
50   start)
51         start
52         ;;
53   stop)
54         stop
55         ;;
56   restart)
57         restart
58         ;;
59   status)
60         status $SERVICE
61         ;;
62   *)
63         echo "Usage: $0 {start|stop|status}"
64         exit 1
65 esac
66
67 exit $RETVAL