# !/bin/bash
n=(1 2 3 4 5 6 )
start(){
for i in ${n[*]}
do
nohup /mirror/kettle/./carte.sh 192.168.180.X 818${i} &
done
}
stop(){
for i in ${n[*]}
do
pid=`lsof -i :818${i} |grep -v 'grep' | awk '{print $2}'`
test "$pid" != "" && kill $pid && echo "Stop carte 818${i} Successful!" || echo "Stop carte$i Failed!"
done
}
case "$1" in
start)
start;;
stop)
stop;;
restart)
stop
sleep 10
start;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0