#!/bin/sh
mark="MARK_RACK_SN"
gw_sn=`/lib/dyiot/bin/factory get | grep SN | awk -F = '{print $2}' | tr '\\n' '\\0'`
echo "******************* Gateway SN $gw_sn ****************************"
rack_sn="${gw_sn}01"
sed s/$mark/$rack_sn/g -i /app/node/nodes_cfg.json
echo "******************* RACK SN $rack_sn is modified ****************************"
echo "******************* Submodule will be reset  ****************************"
/etc/init.d/protocol_parser restart
/etc/init.d/rs485 restart
/etc/init.d/data_reporter restart
/etc/init.d/config_manager restart
/etc/init.d/cloud_conn_dayun restart
echo "******************* System deploy finished  ****************************"
rm $0
