Increase sleep for init script between stop/start
[mirror/scst/.git] / scstadmin / init.d / scst
1 #!/bin/sh
2
3 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin
4 SCST_CMD=/usr/local/sbin/scstadmin
5 SCST_CFG=/etc/scst.conf
6
7 # Modules to load/unload
8 SCST_MODULES="scst_fileio scst_disk scst_cdrom"
9
10 OPTIONS=""
11
12 test -x $SCST_CMD -a -f $SCST_CFG || exit 0
13
14 case "$1" in
15   start)
16         echo -n "Loading and configuring SCSI Target Mid-level: scst "
17
18         modprobe qla2x00tgt || { echo "[qla2x00tgt failed]" ; exit 1 ; }
19
20         for module in ${SCST_MODULES}; do
21                 modprobe ${module} || { echo "[${module} failed]" ; exit 1 ; }
22         done
23
24         $SCST_CMD -config $SCST_CFG
25
26         RC=$?
27
28         if [ $RC -ne 0 ];
29         then
30                 echo "[config failed]"
31         fi
32
33         echo "."
34         ;;
35   stop) 
36         echo -n "Stopping SCSI Target Mid-level: scst "
37
38         for module in ${SCST_MODULES}; do
39                 rmmod ${module} || { echo "[${module} failed]" ; }
40         done
41
42         rmmod qla2x00tgt || { echo "[qla2x00tgt failed]" ; }
43         rmmod scsi_tgt || { echo "[scsi_tgt failed]" ; }
44         
45         echo "."
46         ;;
47   force-reload|restart)
48         $0 stop
49         sleep 5
50         $0 start
51         ;;
52   reload-config)
53         echo -n "Reloading configuration: scst "
54
55         $SCST_CMD -config $SCST_CFG
56
57         RC=$?
58
59         if [ $RC -ne 0 ];
60         then
61                 echo "[config failed]"
62         fi
63
64         echo "."
65         ;;
66   *)
67         echo "Usage: /etc/init.d/scst {start|stop|restart|force-reload|reload-config}"
68         exit 1
69 esac
70
71 exit 0