-#!/bin/bash
+#!/bin/sh
#
# lustre This shell script takes care of starting and stopping Lustre
#
# chkconfig: 345 99 1
# description: Lustre Lite network File System. \
# This starts both Lustre client and server functions.
-# processname: obdctl
-# config: /etc/lustre/lustre.cfg
+# processname: lconf
+# config: /etc/lustre/config.xml
# pidfile: /var/run/lustre.pid
SERVICE=lustre
LOCK=/var/lock/subsys/$SERVICE
+: ${LUSTRE_CFG:=/etc/lustre/lustre.cfg}
+[ -f ${LUSTRE_CFG} ] && . ${LUSTRE_CFG}
+
+: ${LUSTRE_CONFIG_XML:=/etc/lustre/config.xml}
+: ${LCONF:=/usr/sbin/lconf}
+: ${LCONF_START_ARGS:="${LUSTRE_CONFIG_XML}"}
+: ${LCONF_STOP_ARGS:="--force --cleanup ${LUSTRE_CONFIG_XML}"}
+
# Source function library.
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
-[ -f /usr/sbin/obdctl ] || exit 0
+[ -x ${LCONF} -a -f ${LUSTRE_CONFIG_XML} ] || exit 0
+
+# Create /var/lustre directory
+# This is used by snmp agent for checking lustre services \
+# status online/offline/online pending/offline pending.
+
+[ -d ${STATUS_DIR:=/var/lustre} ] || mkdir -p $STATUS_DIR
+STATUS=${STATUS_DIR}/sysStatus
start() {
- echo -n $"Starting $SERVICE: "
- /usr/sbin/llrsetup.sh
- echo $SERVICE
+ echo -n "Starting $SERVICE: "
+ ${LCONF} ${LCONF_START_ARGS}
RETVAL=$?
- [ $RETVAL = 0 ] && touch $LOCK
+ echo $SERVICE
+ if [ $RETVAL -eq 0 ]; then
+ touch $LOCK
+ echo "online" >$STATUS
+ else
+ echo "online pending" >$STATUS
+ fi
}
stop() {
- echo -n $"Shutting down $SERVICE: "
- /usr/sbin/llcleanup.sh
- echo $SERVICE
- rm -f $LOCK
+ echo -n "Shutting down $SERVICE: "
+ ${LCONF} ${LCONF_STOP_ARGS}
+ RETVAL=$?
+ echo $SERVICE
+ rm -f $LOCK
+ if [ $RETVAL -eq 0 ]; then
+ echo "offline" >$STATUS
+ else
+ echo "offline pending" >$STATUS
+ fi
}
restart() {
status $SERVICE
;;
*)
- echo $"Usage: $SERVICE {start|stop|restart|status}"
+ echo "Usage: $SERVICE {start|stop|restart|status}"
exit 1
esac
exit $RETVAL
-