Search

Ver.3

firewall.sh
#!/bin/bash password='alooh1234' agx_ip='192.168.55.1' agx1_ip=${agx_ip} agx2_ip='192.168.56.1' agx1_gpio='32' agx2_gpio='45' lsusb=`lsusb | grep NVidia` dir='~/systeminfo/package/' function reboot_agx(){ sudo ${dir}/AGX_gpio/off_${1}_agx.sh if [ -n ${lsusb} ] ; then sudo ${dir}/AGX_gpio/off_${1}_agx.sh sleep 10 if [ -z ${lsusb} ] ; then sudo ${dir}/AGX_gpio/on_${1}_agx.sh fi fi } function on_agx(){ sudo ${dir}/AGX_gpio/on_${1}_agx.sh } function off_agx(){ sudo ${dir}/AGX_gpio/off_${1}_agx.sh } function set_net_ip(){ sshpass -p ${password} ssh alooh@${agx_ip} "sed -i 's/192.168.55/192.168.56/g' testip.txt" } function create_iptables(){ } function run_micro_service(){ sshpass -p ${password} alooh@${1} "drun_${2}" } # agx2 & agx1 on_agx ${agx2_gpio} set_net_ip reboot_agx ${agx2_gpio} on_agx ${agx1_gpio} # leo create_iptables sudo /sbin/iptables-restore < ${dir}/leo_iptable.rules sshpass -p ${password} scp leo.info alooh@${agx1_ip}:/home/alooh/ sshpass -p ${password} scp leo.info alooh@${agx2_ip}:/home/alooh/ # run micro services run_m_service ${agx1_ip} safety-fence run_m_service ${agx2_ip} person-tracker
Bash