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