#!/bin/bash

system_env_config(){
    for ip in ${IP_LIST[@]}
    do
        ## deploy flush cache
        ssh root@${ip} "mkdir /opt/scripts"
        scp scripts/clean-cache.sh root@${ip}:/opt/scripts/
        scp Install_Packages/bc-1.06.95-13.el7.x86_64.rpm root@${ip}:/tmp/
        ssh root@${ip} "rpm -ivh /tmp/bc-1.06.95-13.el7.x86_64.rpm &> /dev/null"
        ssh root@${ip} "echo '1 */1 * * * /bin/bash /opt/scripts/clean-cache.sh &> /dev/null' > /var/spool/cron/root"
       
        ## config system
        scp scripts/system-config.sh root@${ip}:/tmp/system-config.sh
        ssh root@${ip} "sh /tmp/system-config.sh && rm -rf /tmp/system-config.sh"
    done
}
