#!/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: 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 fi # Source networking configuration. if [ -f /etc/sysconfig/network ] ; then . /etc/sysconfig/network fi # Check that networking is up. [ "${NETWORKING}" = "no" ] && 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: " ${LCONF} ${LCONF_START_ARGS} RETVAL=$? echo $SERVICE if [ $RETVAL -eq 0 ]; then touch $LOCK echo "online" >$STATUS else echo "online pending" >$STATUS fi } stop() { 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() { stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) restart ;; status) status $SERVICE ;; *) echo "Usage: $SERVICE {start|stop|restart|status}" exit 1 esac exit $RETVAL