lundi 8 juin 2020

if loop for multiple condition checks

We are currently using below script to decide on configuration file to be used on server (lets call it OLD_SERVER).

if [[ $VPN_NUMBER == *"_VPN_"* ]] && [[ $AREA == "1" ]]; then
    CONF="/home/onelifetogo/vpn.AM.conf"
else
    CONF="/home/onelifetogo/vpn.PM.conf"
fi

We are going to change server to new one (NEW_SERVER) and according need to use another config files for new servers. New config files are: /home/onelifetogo/new_vpn.AM.conf and /home/onelifetogo/new_vpn.PM.conf

FOr couple of weeks both servers will coexists. Hence I need to achive below:

If the script executes on OLD_SERVER and $VPN_NUMBER == "_VPN_" and $AREA == "1" then script should use CONF="/home/onelifetogo/vpn.AM.conf" else CONF="/home/onelifetogo/vpn.PM.conf"

If the script executes on NEW_SERVER and $VPN_NUMBER == "_VPN_" and $AREA == "1" then script should use CONF="/home/onelifetogo/new_vpn.AM.conf" else CONF="/home/onelifetogo/new_vpn.PM.conf"

Can someone help in this?

Aucun commentaire:

Enregistrer un commentaire