1

cleanup lunportman.sh

This commit is contained in:
eleksir
2016-09-04 23:58:02 +03:00
parent c6e342ea96
commit 88081d1b68

View File

@@ -1,50 +1,49 @@
#!/bin/sh #!/bin/sh
start() start() {
{ if [ -z "$(/sbin/lsmod | /bin/grep fbdisk | /bin/grep -v grep)" ];then
if [ -z "`/sbin/lsmod | /bin/grep fbdisk | /bin/awk {'print $1'}`" ];then
/etc/init.d/fbdisk.sh start /etc/init.d/fbdisk.sh start
fi fi
if [ -f /usr/bin/lunportman ]; then if [ -f /usr/bin/lunportman ]; then
echo "Starting LUN Porter manitor: lunportman..." echo "Starting LUN Porter manitor: lunportman..."
[ -d /etc/config/lunporter ] || /usr/bin/install -d /etc/config/lunporter [ -d /etc/config/lunporter ] || /bin/mkdir /etc/config/lunporter
[ -h /etc/lunporter ] || /bin/ln -sf config/lunporter /etc/lunporter [ -h /etc/lunporter ] || /bin/ln -sf config/lunporter /etc/lunporter
[ -f /etc/config/lunporter/lunporter.conf ] || /bin/cp -p /etc/default_config/lunporter/lunporter.conf /etc/config/lunporter/lunporter.conf [ -f /etc/config/lunporter/lunporter.conf ] || /bin/cp -p /etc/default_config/lunporter/lunporter.conf /etc/config/lunporter/lunporter.conf
/usr/bin/lunportman /usr/bin/lunportman
fi fi
} }
stop() stop() {
{
echo "Shutting down LUN Porter manitor: lunportman..." echo "Shutting down LUN Porter manitor: lunportman..."
/usr/bin/killall -q lunportman /usr/bin/killall -q lunportman
CNT=0 CNT=0
while [ $CNT -lt 10 ]; do while [ $CNT -lt 10 ]; do
sleep 3 sleep 3
/bin/pidof lunporter 1>>/dev/null 2>>/dev/null /bin/pidof lunporter 1>>/dev/null 2>>/dev/null
[ $? = 0 ] || break [ $? = 0 ] || break
CNT=`expr $CNT + 1` CNT=$(($CNT + 1))
done done
} }
case "$1" in case "$1" in
start) "start")
start start
;; ;;
stop) "stop")
stop stop
;; ;;
restart) "restart")
stop stop
sleep 1 sleep 1
start start
;; ;;
*) *)
echo "Usage: /etc/init.d/lunportman.sh {start|stop|restart}" echo "Usage: /etc/init.d/lunportman.sh {start|stop|restart}"
exit 1 exit 1
esac esac