| 1 | #! /bin/sh |
|---|
| 2 | # |
|---|
| 3 | # skeleton example file to build /etc/init.d/ scripts. |
|---|
| 4 | # This file should be used to construct scripts for /etc/init.d. |
|---|
| 5 | # |
|---|
| 6 | # Written by Miquel van Smoorenburg <miquels@cistron.nl>. |
|---|
| 7 | # Modified for Debian |
|---|
| 8 | # by Ian Murdock <imurdock@gnu.ai.mit.edu>. |
|---|
| 9 | # Further changes by Javier Fernandez-Sanguino <jfs@debian.org> |
|---|
| 10 | # |
|---|
| 11 | # Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl |
|---|
| 12 | # |
|---|
| 13 | ### BEGIN INIT INFO |
|---|
| 14 | # Provides: drbl-mount-lustre |
|---|
| 15 | # Required-Start: $network $local_fs |
|---|
| 16 | # Required-Stop: |
|---|
| 17 | # Should-Start: $named |
|---|
| 18 | # Should-Stop: |
|---|
| 19 | # Default-Start: 2 3 4 5 |
|---|
| 20 | # Default-Stop: 0 1 6 |
|---|
| 21 | # Short-Description: mount local disks as Lustre OST |
|---|
| 22 | ### END INIT INFO |
|---|
| 23 | |
|---|
| 24 | set -e |
|---|
| 25 | |
|---|
| 26 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
|---|
| 27 | NAME=drbl-mount-lustre |
|---|
| 28 | DESC="mount local disks as Lustre OST" |
|---|
| 29 | |
|---|
| 30 | PIDFILE=/var/run/drbl-lustre.pid |
|---|
| 31 | DODTIME=3 # Time to wait for the server to die, in seconds |
|---|
| 32 | # If this value is set too low you might not |
|---|
| 33 | # let some servers to die gracefully and |
|---|
| 34 | # 'restart' will not work |
|---|
| 35 | start() { |
|---|
| 36 | modprobe ldiskfs |
|---|
| 37 | modprobe lnet |
|---|
| 38 | modprobe lustre |
|---|
| 39 | |
|---|
| 40 | mount -t lustre /dev/sdb1 /lustre/mdt |
|---|
| 41 | mount -t lustre /dev/sdb2 /lustre/ost |
|---|
| 42 | mount -t lustre 192.168.129.1@tcp:/biofs /lustre/bio |
|---|
| 43 | |
|---|
| 44 | touch $PIDFILE |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | stop() { |
|---|
| 48 | umount /lustre/bio |
|---|
| 49 | umount /lustre/ost2 |
|---|
| 50 | umount /lustre/ost1 |
|---|
| 51 | |
|---|
| 52 | rm -f $PIDFILE |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | case "$1" in |
|---|
| 56 | start) |
|---|
| 57 | echo -n "Starting $DESC: " |
|---|
| 58 | start |
|---|
| 59 | if [ -f $PIDFILE ] ; then |
|---|
| 60 | echo "OK." |
|---|
| 61 | else |
|---|
| 62 | echo "ERROR." |
|---|
| 63 | fi |
|---|
| 64 | ;; |
|---|
| 65 | stop) |
|---|
| 66 | echo -n "Stopping $DESC: " |
|---|
| 67 | stop |
|---|
| 68 | if [ ! -f $PIDFILE ] ; then |
|---|
| 69 | echo "OK." |
|---|
| 70 | else |
|---|
| 71 | echo "ERROR." |
|---|
| 72 | fi |
|---|
| 73 | ;; |
|---|
| 74 | force-reload) |
|---|
| 75 | if [ -f $PIDFILE ] ; then |
|---|
| 76 | $0 restart |
|---|
| 77 | fi |
|---|
| 78 | ;; |
|---|
| 79 | restart) |
|---|
| 80 | echo -n "Restarting $DESC: " |
|---|
| 81 | if [ -f $PIDFILE ] ; then |
|---|
| 82 | stop |
|---|
| 83 | fi |
|---|
| 84 | [ -n "$DODTIME" ] && sleep $DODTIME |
|---|
| 85 | $0 start |
|---|
| 86 | ;; |
|---|
| 87 | status) |
|---|
| 88 | echo -n "Lustre is " |
|---|
| 89 | if [ -f $PIDFILE ] ; then |
|---|
| 90 | echo "mounted" |
|---|
| 91 | mount -t lustre -l |
|---|
| 92 | else |
|---|
| 93 | echo "not mounted." |
|---|
| 94 | exit 1 |
|---|
| 95 | fi |
|---|
| 96 | ;; |
|---|
| 97 | *) |
|---|
| 98 | N=/etc/init.d/$NAME |
|---|
| 99 | echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 |
|---|
| 100 | exit 1 |
|---|
| 101 | ;; |
|---|
| 102 | esac |
|---|
| 103 | exit 0 |
|---|
| 104 | |
|---|