Whamcloud - gitweb
LU-8384 scripts: Add scripts to systemd for EL7
[fs/lustre-release.git] / lustre / scripts / lustre
1 #!/bin/bash
2 #
3 # lustre        This shell script takes care of starting and stopping
4 #               the lustre services.
5 #
6 # chkconfig: - 60 20
7 # description:  Part of the lustre file system.
8 # probe: true
9 # config: /etc/sysconfig/lustre
10 ### BEGIN INIT INFO
11 # Provides: lustre
12 # Required-Start: openibd
13 # Defalt-Start: -
14 # Default-Stop: 0 1 6
15 # Description: Lustre init script
16 ### END INIT INFO
17
18 PATH=/sbin:/usr/sbin:/bin:/usr/bin
19
20 # Source function library.
21 . /etc/rc.d/init.d/functions
22
23 # Source networking configuration.
24 if [ ! -f /etc/sysconfig/network ]; then
25         exit 0
26 fi
27
28 . /etc/sysconfig/network
29
30 LDEV=${LDEV:-"/usr/sbin/ldev"}
31 ZPOOL_LAYOUT=/usr/bin/zpool_layout
32 UDEVADM=${UDEVADM:-/sbin/udevadm}
33
34 # Check that networking is up.
35 [ "${NETWORKING}" = "no" ] && exit 0
36
37 # Check for and source configuration file otherwise set defaults
38 [ -f /etc/sysconfig/lustre ] && . /etc/sysconfig/lustre
39 FSCK_ARGS=${FSCK_ARGS:-""}
40 MOUNT_OPTIONS=${MOUNT_OPTIONS:-""}
41 LOCAL_SRV=${LOCAL_SRV:-"`$LDEV -l 2>/dev/null`"}
42 FOREIGN_SRV=${FOREIGN_SRV:-"`$LDEV -f 2>/dev/null`"}
43 REQUIRE_MMP_FEATURE=${REQUIRE_MMP_FEATURE:-${FOREIGN_SRV:+"yes"}}
44 LOCAL_MOUNT_DIR=${LOCAL_MOUNT_DIR:-"/mnt/lustre/local"}
45 FOREIGN_MOUNT_DIR=${FOREIGN_MOUNT_DIR:-"/mnt/lustre/foreign"}
46 SETUP_DEVICES=${SETUP_DEVICES:-""}
47 ZPOOL_LAYOUT_BUSES=${ZPOOL_LAYOUT_BUSES:-""}
48 ZPOOL_LAYOUT_PORTS=${ZPOOL_LAYOUT_PORTS:-""}
49 ZPOOL_LAYOUT_MAP=${ZPOOL_LAYOUT_MAP:-""}
50 MOUNT_DELAY=${MOUNT_DELAY:-2}
51 LOAD_ZFS=${LOAD_ZFS:-""}
52
53 if [ -z "$TUNE2FS" ] ; then
54         TUNE2FS=`which tunefs.ldiskfs 2>/dev/null`
55         if [ -z "$TUNE2FS" ] ; then
56                 TUNE2FS=`which tune2fs 2>/dev/null`
57         fi
58 fi
59
60 if [ -z "$PFSCK" ] ; then
61         PFSCK=`which pfsck.ldiskfs 2>/dev/null`
62         if [ -z "$PFSCK" ] ; then
63                 PFSCK=`which fsck 2>/dev/null`
64         fi
65 fi
66
67 shopt -s nullglob
68
69 start_zfs_services ()
70 {
71         if [ -n "$ZPOOL_LAYOUT_BUSES" -a -n "$ZPOOL_LAYOUT_PORTS" ] ; then
72                 MAP_ARG=${ZPOOL_LAYOUT_MAP:+"-m $ZPOOL_LAYOUT_MAP"}
73                 $ZPOOL_LAYOUT -t -b "$ZPOOL_LAYOUT_BUSES" \
74                         -p "$ZPOOL_LAYOUT_PORTS" $MAP_ARG
75         fi
76         if [ "$LOAD_ZFS" = "yes" ] && ! modprobe zfs ; then
77                 echo "Failed to load zfs module.  Aborting."
78                 exit 1
79         fi
80 }
81
82 stop_devices ()
83 {
84         local labels=$*
85         local label devtype
86         for label in $labels; do
87                 devtype=`$LDEV -t $label`
88                 if [ "$devtype" = "zfs" ] ; then
89                         export_zpool $label
90                 elif [ "$devtype" = "md" ] ; then
91                         dev=`label_to_device $label`
92                         journal=`$LDEV -j $label`
93                         stop_md_device $dev
94                         stop_md_device $journal
95                 fi
96         done
97 }
98
99 import_zpool ()
100 {
101         local result=1
102         local label=$1
103         local pool=`$LDEV -z $label`
104         local args="-N $ZPOOL_IMPORT_ARGS"
105         local cache=`$LDEV -r $label`
106         # -c is incompatible with -d
107         if [ -n "$cache" ] ; then
108                 args="$args -c $cache"
109         elif [ -n "$ZPOOL_IMPORT_DIR" ] ; then
110                 args="$args -d $ZPOOL_IMPORT_DIR"
111         fi
112
113         if zpool status $pool >/dev/null 2>&1 ; then
114                 result=0
115         elif [ -n "$pool" ] ; then
116                 zpool import $pool $args 2>/dev/null
117                 result=$?
118         fi
119         if [ $result -ne 0 ] ; then
120                 echo "Unexpected return code from import of pool $pool: $result"
121         fi
122         return $result
123 }
124
125 export_zpool ()
126 {
127         local label=$1
128         local pool=`$LDEV -z $label`
129         zpool export $pool 2>/dev/null
130 }
131
132 # Trigger udev and wait for it to settle.
133 udev_trigger()
134 {
135         if [ -x ${UDEVADM} ]; then
136                 ${UDEVADM} trigger --action=change --subsystem-match=block
137                 ${UDEVADM} settle
138         else
139                 /sbin/udevtrigger
140                 /sbin/udevsettle
141         fi
142 }
143
144 # Usage: run_preexec_check [ start | restart | condrestart ]
145 # The single parameter will be passed to the PREEXEC_SCRIPT
146 run_preexec_check ()
147 {
148         if [ -n "$PREEXEC_CHECK" ] && ! $PREEXEC_CHECK ; then
149                 echo "Pre-exec check \"$PREEXEC_CHECK\" failed.  Aborting."
150                 exit 1
151         fi
152
153         if [ -n "$PREEXEC_SCRIPT" ] && ! "$PREEXEC_SCRIPT" "$1" ; then
154                 echo "Pre-exec script \"$PREEXEC_SCRIPT\" failed.  Aborting."
155                 exit 1
156         fi
157 }
158
159 # Usage: run_postexec_check [ start | restart | condrestart ]
160 # The single parameter will be passed to the PREEXEC_SCRIPT
161 run_postexec_check ()
162 {
163         if [ -n "$POSTEXEC_CHECK" ] && ! $POSTEXEC_CHECK ; then
164                 echo "Post-exec check \"$POSTEXEC_CHECK\" failed.  Aborting."
165                 exit 1
166         fi
167
168         if [ -n "$POSTEXEC_SCRIPT" ] && ! "$POSTEXEC_SCRIPT" "$1" ; then
169                 echo "Post-exec script \"$POSTEXEC_SCRIPT\" failed.  Aborting."
170                 exit 1
171         fi
172 }
173
174 # Usage: adjust_scsi_timeout <dev>
175 adjust_scsi_timeout ()
176 {
177         local dev=$1
178
179         if [ -n "$SCSI_DEVICE_TIMEOUT" ]; then
180                 # make sure that it is actually a SCSI (sd) device
181                 local name=`basename $dev`
182                 local proc=/sys/block/${name}/device/timeout
183                 local driver=`readlink /sys/block/${name}/device/driver`
184                 if [ -n "$driver" ] && [ "`basename $driver`" == "sd" ]; then
185                         if ! echo $SCSI_DEVICE_TIMEOUT >$proc; then
186                                 echo "FAILED: could not adjust ${dev} timeout"
187                                 return 1
188                         fi
189                 fi
190         fi
191         return 0
192 }
193
194 # Usage: fsck_test <dev> [ <dev> ... ]
195 # Checks all devices in parallel if FSCK_ARGS is set.
196 fsck_test ()
197 {
198         local devices="$*"
199
200         # Filter out non-absolute paths, which are probably ZFS datasets
201         devices=`echo $devices |xargs -n 1|grep '^/'|xargs`
202
203         if [ -n "${FSCK_ARGS}" -a -n "$devices" ]; then
204                 if [ -x $PFSCK ] ; then
205                         echo "$PFSCK $devices -- ${FSCK_ARGS}"
206                         $PFSCK $devices -- ${FSCK_ARGS}
207                         if [ $? -ne 0 -a $? -ne 1 ] ; then
208                                 echo "FAILED: $PFSCK -- ${FSCK_ARGS}: $?"
209                                 return 1
210                         fi
211                 else
212                         echo "$PFSCK not found"
213                         return 1
214                 fi
215         fi
216         return 0
217 }
218
219 # Usage: test_feature_flag <dev> <flag>
220 test_feature_flag()
221 {
222         local dev=$1
223         local flag=$2
224         local result=1
225         local feature
226
227         for feature in `$TUNE2FS -l $dev 2>/dev/null \
228                                 | grep features: | sed -e 's/^.*: //'`; do
229                 if [ "$feature" == "$flag" ]; then
230                         result=0
231                         break
232                 fi
233         done
234
235         return $result
236 }
237
238 # Usage: mmp_test <dev>
239 # Returns 0 if it is set or not required, 1 if unset and required or error.
240 mmp_test ()
241 {
242         local dev=$1
243         local result=0
244
245         if [ "$REQUIRE_MMP_FEATURE" == "yes" ]; then
246                 if [ -x $TUNE2FS ]; then
247                         if ! test_feature_flag $dev "mmp"; then
248                                 echo "mmp feature flag is not set on $dev"
249                                 result=1
250                         fi
251                 else
252                         echo "$TUNE2FS not found"
253                         result=1
254                 fi
255         fi
256
257         return $result
258 }
259
260 # Usage: label_to_mountpt <label>
261 # Prints mount point path, if label matches a local or foreign server.
262 label_to_mountpt ()
263 {
264         local label=$1
265         local serv
266
267         for serv in $LOCAL_SRV; do
268                 if [ "$serv" == "$label" ]; then
269                         echo "$LOCAL_MOUNT_DIR/$label"
270                         return
271                 fi
272         done
273         for serv in $FOREIGN_SRV; do
274                 if [ "$serv" == "$label" ]; then
275                         echo "$FOREIGN_MOUNT_DIR/$label"
276                         return
277                 fi
278         done
279 }
280
281 # Usage: label_to_device <label>
282 # Prints canonical device path.
283 label_to_device ()
284 {
285         local label=$1
286         local path=/dev/disk/by-label/$label
287
288         if [ -h $path ] ; then
289                 readlink --canonicalize $path
290         else
291                 $LDEV -d $label
292         fi
293 }
294
295 # helper for mountpt_is_active() and device_is_active()
296 declare -r awkprog='BEGIN {rc = 1;}
297                         { if ($field == path) {rc = 0;} }
298                     END { exit rc;}'
299
300 # Usage: mountpt_is_active <label>
301 # Return 1 (inactive) on invalid label.
302 mountpt_is_active ()
303 {
304         local dir=`label_to_mountpt $1`
305         local result=1
306
307         if [ -n "$dir" ]; then
308                 cat /proc/mounts | awk "$awkprog" field=2 path=$dir
309                 result=$?
310         fi
311         return $result
312 }
313
314 # Usage: device_is_active <label>
315 # Return 1 (inactive) on invalid label.
316 device_is_active ()
317 {
318         local dev=`label_to_device $1`
319         local result=1
320
321         if [ -n "$dev" ]; then
322                 cat /proc/mounts | awk "$awkprog" field=1 path=$dir
323                 result=$?
324         fi
325         return $result
326 }
327
328 # Usage: mount_one_device <label> <successflag> [devtype]
329 # Remove <successflag> on error (trick to detect errors after parallel runs).
330 mount_one_device ()
331 {
332         local label=$1
333         local successflag=$2
334         local devtype=$3
335         local dev=`label_to_device $label`
336         local dir=`label_to_mountpt $label`
337
338         # $dir and $dev have already been checked at ths point
339         if [ ! -d $dir ] && ! mkdir -p $dir; then
340                 rm -f $successflag
341                 return
342         fi
343         echo "Mounting $dev on $dir"
344         if ! mount -t lustre $MOUNT_OPTIONS $dev $dir; then
345                 rm -f $successflag
346                 return
347         fi
348 }
349
350 # Usage: assemble_md_device <device>
351 # Assemble the md device backing device.
352 # Return 0 if the array is assembled successfully or was already active,
353 # otherwise return error code from mdadm.
354 assemble_md_device ()
355 {
356         local dev=$1
357         local raidtab=$2
358         local args="-Aq"
359         local result=0
360
361         if [ -n "$raidtab" ] ; then
362                 args="$args -c $raidtab"
363         fi
364
365         if ! md_array_is_active $dev ; then
366                 mdadm $args $dev
367                 result=$?
368         fi
369
370         udev_trigger
371         return $result
372 }
373
374 # Usage: stop_md_device <device>
375 # Stop the md device backing device.
376 # Return 0 if the array is stopped successfully or was not active,
377 # otherwise return error code from mdadm.
378 stop_md_device ()
379 {
380         local dev=$1
381         local raidtab=$2
382         local args="-Sq"
383         local result=0
384
385         if [ -n "$raidtab" ] ; then
386                 args="$args -c $raidtab"
387         fi
388
389         if [ -e $dev ] && md_array_is_active $dev ; then
390                 mdadm $args $dev
391                 result=$?
392         fi
393
394         return $result
395 }
396
397 # Usage: md_array_is_active <device>
398 # return 0 if device is an active md RAID array, or 1 otherwise
399 md_array_is_active ()
400 {
401         local device=$1
402
403         [ -e "$device" ] || return 1
404
405         mdadm --detail -t $device > /dev/null 2>&1
406         if [ $? -eq 4 ] ; then
407                 return 1
408         fi
409         return 0
410 }
411
412 # Usage: start_services <label> [ <label> ... ]
413 # fsck and mount any devices listed as arguments (in parallel).
414 # Attempt to assemble software raid arrays or zfs pools backing
415 # Lustre devices.
416 start_services ()
417 {
418         local result=0
419         local devices=""
420         local dir dev label
421         local successflag
422         local labels
423
424         start_zfs_services
425         for label in $*; do
426                 dir=`label_to_mountpt $label`
427                 devtype=`$LDEV -t $label`
428                 dev=`label_to_device $label`
429                 journal=`$LDEV -j $label`
430                 raidtab=`$LDEV -r $label`
431
432                 if [ -z "$dir" ] || [ -z "$dev" ]; then
433                         echo "$label is not a valid lustre label on this node"
434                         result=2
435                         continue
436                 fi
437
438                 if [ "$devtype" = "md" ] ; then
439                         if ! assemble_md_device $dev $raidtab ; then
440                                 echo "failed to assemble array $dev backing $label"
441                                 result=2
442                                 continue
443                         fi
444                 elif [ "$devtype" = "zfs" ] ; then
445                         if ! import_zpool $label ; then
446                                 result=2
447                         fi
448                 fi
449
450                 # Journal device field in ldev.conf may be "-" or empty,
451                 # so only attempt to assemble if its an absolute path.
452                 # Ignore errors since the journal device may not be an
453                 # md device.
454                 if echo $journal | grep -q ^/ ; then
455                         assemble_md_device $journal $raidtab 2>/dev/null
456                 fi
457
458                 if [ "x$devtype" != "xzfs" ] ; then
459                         if mountpt_is_active $label || \
460                            device_is_active $label; then
461                                 echo "$label is already mounted"
462                                 # no error
463                                 continue
464                         fi
465                         if ! mmp_test $dev; then
466                                 result=2
467                                 continue
468                         fi
469                         if ! adjust_scsi_timeout $dev; then
470                                 result=2
471                                 continue
472                         fi
473                 fi
474                 devices="$devices $dev"
475                 labels="$labels $label"
476         done
477         if [ $result == 0 ]; then
478                 fsck_test $devices || return 2
479
480                 # Fork to handle multiple mount_one_device()'s in parallel.
481                 # Errors occurred if $successflag comes up missing afterwards.
482                 successflag=`mktemp`
483                 [ -e $successflag ] || return 2
484                 for label in $labels; do
485                         mount_one_device $label $successflag `$LDEV -t $label` &
486                         # stagger to avoid module loading races
487                         if [[ -n $MOUNT_DELAY && $MOUNT_DELAY -gt 0 ]] ; then
488                                 sleep $MOUNT_DELAY
489                         fi
490                 done
491                 for label in $labels; do
492                         wait
493                 done
494                 [ -e $successflag ] || return 2
495                 rm -f $successflag
496         fi
497
498         return $result
499 }
500
501 # Usage: stop_services <label> [ <label> ... ]
502 # Unmount any devices listed as arguments (serially).
503 # Any devices which are not mounted or don't exist are skipped with no error.
504 stop_services ()
505 {
506         local labels=$*
507         local result=0
508         local pids=""
509         local dir dev label
510
511         for label in $labels; do
512                 dir=`label_to_mountpt $label`
513                 if [ -z "$dir" ]; then
514                         echo "$label is not a valid lustre label on this node"
515                         result=2
516                         continue
517                 fi
518                 if ! mountpt_is_active $label; then
519                         #echo "$label is not mounted"
520                         # no error
521                         continue
522                 fi
523
524                 echo "Unmounting $dir"
525                 umount $dir &
526
527                 if [ -z "$pids" ]; then
528                         pids="$!"
529                 else
530                         pids="$pids $!"
531                 fi
532         done
533
534         # wait for all umount processes to complete, report any errors
535         for pid in $pids; do
536                 wait $pid || result=2
537         done
538
539         # double check!
540         for label in $labels; do
541                 if mountpt_is_active $label; then
542                         dir=`label_to_mountpt $label`
543                         echo "Mount point $dir is still active"
544                         result=2
545                 fi
546                 if device_is_active $label; then
547                         dev=`label_to_device $label`
548                         echo "Device $dev is still active"
549                         result=2
550                 fi
551         done
552         stop_devices $labels
553
554         return $result
555 }
556
557 # Usage: start_lustre_services [local|foreign|all|<label>]
558 # If no parameter is specified, local devices will be started.
559 start_lustre_services ()
560 {
561         local labels=""
562
563         case "$1" in
564                 ""|local)
565                         labels=$LOCAL_SRV
566                         ;;
567                 foreign)
568                         labels=$FOREIGN_SRV
569                         ;;
570                 all)    labels="$LOCAL_SRV $FOREIGN_SRV"
571                         ;;
572                 *)      labels="$1"
573                         ;;
574         esac
575         # for use by heartbeat V1 resource agent:
576         # starting an already-started service must not be an error
577         start_services $labels || exit 2
578 }
579
580 # Usage: stop_lustre_services [local|foreign|all|<label>]
581 # If no parameter is specified all devices will be stopped.
582 stop_lustre_services ()
583 {
584         local labels=""
585
586         case "$1" in
587                 local) labels=$LOCAL_SRV
588                         ;;
589                 foreign)
590                         labels=$FOREIGN_SRV
591                         ;;
592                 ""|all) labels="$LOCAL_SRV $FOREIGN_SRV"
593                         ;;
594                 *)      labels="$1"
595                         ;;
596         esac
597         # for use by heartbeat V1 resource agent:
598         # stopping already-stopped service must not be an error
599         stop_services $labels || exit 2
600 }
601
602 # General lustre health check - not device specific.
603 health_check ()
604 {
605
606         old_nullglob="`shopt -p nullglob`"
607         shopt -u nullglob
608
609         STATE="stopped"
610         # LSB compliance - return 3 if service is not running
611         # Lustre-specific returns
612         # 150 - partial startup
613         # 151 - health_check unhealthy
614         # 152 - LBUG
615         RETVAL=3
616         egrep -q "libcfs|lvfs|portals" /proc/modules && STATE="loaded"
617
618         # check for any configured devices (may indicate partial startup)
619         VAR=$(lctl get_param version 2>&1)
620         if [ $? = 0 ] ; then
621                 VAR=$(lctl get_param -n devices 2>&1)
622                 if [ $? = 0 ] ; then
623                         STATE="partial"
624                         RETVAL=150
625                 fi
626
627                 # check for either a server or a client filesystem
628                 local MGT=""
629                 local MDT=""
630                 local OST=""
631                 local LLITE=""
632
633                 ! lctl get_param -n mgs.MGS.* >/dev/null 2>&1 || MGT="YES"
634
635                 VAR=$(lctl get_param -n mdt.*.recovery_status 2>&1 | grep '^status:'  )
636                 if [ $? = 0 ] ; then
637                         MDT=$VAR
638                 fi
639
640                 VAR=$(lctl get_param -n obdfilter.*.recovery_status 2>&1 | grep '^status:')
641                 if [ $? = 0 ] ; then
642                         OST=$VAR
643                 fi
644
645                 VAR=$(lctl get_param -n llite.fs* 2>&1)
646                 if [ $? = 0 ] ; then
647                         LLITE="YES"
648                 fi
649
650                 if [ "$MGT" -o "$MDT" -o "$OST" -o "$LLITE" ]; then
651                         STATE="running"
652                         RETVAL=0
653                 fi
654         else
655                 # check if this is a router
656                 if [[ "$(lctl get_param -n routes)" =~ "Routing enabled" ]]; then
657                         STATE="running"
658                         RETVAL=0
659                 fi
660         fi
661
662         # check for server disconnections
663         VAR=$(lctl get_param -n *c.*.*server_uuid 2>&1)
664         if [ $? = 0 ] ; then
665                 DISCON="$(echo $VAR | grep -v FULL)"
666                 if [ -n "$DISCON" ] ; then
667                         STATE="disconnected"
668                         RETVAL=0
669                 fi
670         fi
671
672         # check for servers in recovery
673         if [ -n "$MDT$OST" ] && echo $MDT $OST | grep -q RECOV ; then
674                 STATE="recovery"
675                 RETVAL=0
676         fi
677
678         # check for error in health_check
679         local health_check=$(lctl get_param -n health_check)
680         if [[ "$health_check" =~ "NOT HEALTHY" ]]; then
681                 STATE="unhealthy"
682                 RETVAL=1
683         fi
684
685         # check for LBUG
686         if [[ "$health_check" =~ "LBUG" ]]; then
687                 STATE="LBUG"
688                 RETVAL=152
689         fi
690
691         echo $STATE
692         eval $old_nullglob
693         return $RETVAL
694 }
695
696 # Usage: status [local|foreign|all|<label>]
697 # If no parameter is specified, general lustre health status will be reported.
698 status ()
699 {
700         local labels=""
701         local label dir
702         local valid_devs=0
703
704         case "$1" in
705                 local) labels=$LOCAL_SRV;
706                         ;;
707                 foreign)
708                         labels=$FOREIGN_SRV;
709                         ;;
710                 all)    labels="$LOCAL_SRV $FOREIGN_SRV"
711                         ;;
712                 "")     # ASSUMPTION: this is not the heartbeat res agent
713                         health_check
714                         exit $?
715                         ;;
716                 *)      labels=$1
717                         ;;
718         esac
719         # for use by heartbeat V1 resource agent:
720         # print "running" if *anything* is running.
721         for label in $labels; do
722                 dir=`label_to_device $label`
723                 if [ -z "$dir" ]; then
724                         echo "$label is not a valid lustre label on this node"
725                         # no error
726                         continue
727                 fi
728                 valid_devs=1
729                 if mountpt_is_active $label || device_is_active $label; then
730                         echo "running"
731                         exit 0
732                 fi
733         done
734         [ $valid_devs == 1 ] && echo "stopped"
735         exit 3
736 }
737
738 usage ()
739 {
740         cat <<EOF
741 Usage: lustre {start|stop|status|restart|reload|condrestart}
742
743        lustre start  [local|foreign|<label>]
744        lustre stop   [local|foreign|<label>]
745        lustre status [local|foreign|<label>]
746 EOF
747         exit 1
748 }
749
750 # See how we were called.
751 case "$1" in
752   start)
753         if [ $# -gt 2 ] ; then
754                 echo "ERROR: Too many arguments."
755                 usage
756         fi
757         run_preexec_check "start"
758         start_lustre_services $2
759         run_postexec_check "start"
760         ;;
761   stop)
762         if [ $# -gt 2 ] ; then
763                 echo "ERROR: Too many arguments."
764                 usage
765         fi
766         run_preexec_check "stop"
767         stop_lustre_services $2
768         run_postexec_check "stop"
769         ;;
770   status)
771         if [ $# -gt 2 ] ; then
772                 echo "ERROR: Too many arguments."
773                 usage
774         fi
775         status $2
776         ;;
777   restart)
778         $0 stop
779         $0 start
780         ;;
781   reload)
782         ;;
783   probe)
784         ;;
785   condrestart)
786         if grep lustre /proc/mounts ; then
787                 $0 stop
788                 $0 start
789         fi
790         ;;
791   *)
792         usage
793 esac
794
795 exit 0