Whamcloud - gitweb
Bug #364: Approver - Robert Reed: Update lustre init script to use lconf.
[fs/lustre-release.git] / lustre / scripts / lustre
1 #!/bin/sh
2 #
3 # lustre   This shell script takes care of starting and stopping Lustre
4 #
5 # chkconfig: 345 99 1
6 # description: Lustre Lite network File System.                              \
7 #              This starts both Lustre client and server functions.
8 # processname: lconf
9 # config: /etc/lustre/config.xml
10 # pidfile: /var/run/lustre.pid
11
12 SERVICE=lustre
13 LOCK=/var/lock/subsys/$SERVICE
14
15 : ${LUSTRE_CFG:=/etc/lustre/lustre.cfg}
16 [ -f ${LUSTRE_CFG} ] && . ${LUSTRE_CFG}
17
18 : ${LUSTRE_CONFIG_XML:=/etc/lustre/config.xml}
19 : ${LCONF:=/usr/sbin/lconf}
20 : ${LCONF_START_ARGS:="${LUSTRE_CONFIG_XML}"}
21 : ${LCONF_STOP_ARGS:="--force --cleanup ${LUSTRE_CONFIG_XML}"}
22
23 # Source function library.
24 if [ -f /etc/init.d/functions ] ; then
25    . /etc/init.d/functions
26 fi
27
28 # Source networking configuration.
29 if [ -f /etc/sysconfig/network ] ; then
30    . /etc/sysconfig/network
31 fi
32
33 # Check that networking is up.
34 [ "${NETWORKING}" = "no" ] && exit 0
35
36 [ -x ${LCONF} -a -f ${LUSTRE_CONFIG_XML} ] || exit 0
37
38 start() {
39         echo -n "Starting $SERVICE: "
40         ${LCONF} ${LCONF_START_ARGS}
41         RETVAL=$?
42         echo $SERVICE
43         [ $RETVAL -eq 0 ] && touch $LOCK
44 }
45
46 stop() {
47         echo -n "Shutting down $SERVICE: "
48         ${LCONF} ${LCONF_STOP_ARGS}
49         echo $SERVICE
50         rm -f $LOCK
51 }
52
53 restart() {
54         stop
55         start
56 }
57
58 # See how we were called.
59 case "$1" in
60   start)
61         start
62         ;;
63   stop)
64         stop
65         ;;
66   restart)
67         restart
68         ;;
69   status)
70         status $SERVICE
71         ;;
72   *)
73         echo "Usage: $SERVICE {start|stop|restart|status}"
74         exit 1
75 esac
76
77 exit $RETVAL