gpt-2741gnac_root_files/_mtdblock5.img.extracted/squashfs-root/usr/script/start_soniq.sh
2023-11-26 03:26:24 -03:00

133 lines
No EOL
2.3 KiB
Bash
Executable file

#!/bin/sh
# booting with disabled roaming
boot_0()
{
keep_go=1
while [ "${keep_go}" == 1 ]
do
rpe_status=`call_qcsapi_sockrpc --host 1.1.1.2 get_macaddr br0:9`
if [ "$?" == "0" ]; then
/usr/sbin/rpecat -c netlink -r `call_qcsapi_sockrpc --host 1.1.1.2 get_macaddr br0:9` &
sleep 2
rpe_exist=`ps | grep rpecat | grep -v grep`
if [ "$rpe_exist" != "" ]; then
echo "start_soniq.sh@boot(): bring up rpecat successfully!"
keep_go=0
fi
fi
if [ "${keep_go}" == "1" ]; then
sleep 2
fi
done
intf_status=`ip a | grep ra0 | grep UP`
if [ "$?" == "0" ]; then
bsa_exist=`ps | grep bsa_peer_ecnt | grep -v grep`
if [ "$bsa_exist" == "" ]; then
bsa_peer_ecnt &
sleep 2
bsa_exist=`ps | grep bsa_peer_ecnt | grep -v grep`
if [ "$bsa_exist" != "" ]; then
echo "start_soniq.sh@boot(): bring up bsa_peer_ecnt successfully!"
fi
fi
fi
}
start()
{
keep_go=1
while [ "${keep_go}" == 1 ]
do
killall -9 csmd 2>/dev/null
sleep 5
/usr/sbin/csmd -c /etc/csmd.json >/dev/console 2>/dev/console &
sleep 2
csmd_exist=`ps | grep csmd | grep -v grep`
if [ "$csmd_exist" != "" ]; then
echo "start_soniq.sh@start(): bring up csmd successfully!"
keep_go=0
fi
if [ "${keep_go}" == "1" ]; then
sleep 2
fi
done
}
# booting with enabled roaming
boot_1()
{
boot_0
start
}
stop()
{
keep_go=1
while [ "${keep_go}" == 1 ]
do
killall -9 csmd 2>/dev/null
sleep 1
csmd_exist=`ps | grep csmd | grep -v grep`
if [ "$csmd_exist" == "" ]; then
echo "start_soniq.sh@stop(): shut down csmd successfully!"
keep_go=0
fi
done
}
restart()
{
stop
start
}
bring_bsa()
{
intf_status=`ip a | grep ra0 | grep UP`
if [ "$?" == "0" ]; then
bsa_exist=`ps | grep bsa_peer_ecnt | grep -v grep`
if [ "$bsa_exist" == "" ]; then
bsa_peer_ecnt &
sleep 2
bsa_exist=`ps | grep bsa_peer_ecnt | grep -v grep`
if [ "$bsa_exist" != "" ]; then
echo "start_soniq.sh@bring_bsa(): bring up bsa_peer_ecnt successfully!"
csmd_exist=`ps | grep csmd | grep -v grep`
if [ "$csmd_exist" != "" ]; then
echo "start_soniq.sh@bring_bsa(): need to restart csmd..."
start
fi
fi
fi
fi
}
case "$1" in
boot_0)
boot_0
;;
boot_1)
boot_1
;;
bring_bsa)
bring_bsa
;;
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?