I have this bash script that isn't working the way I want it. In my script, I first create a variable called 'ip' which is the ip address for the server using this command:
ip=`grep IPADDR /etc/sysconfig/network-scripts/ifcfg-venet0:0 | awk -F= '{print $2}'`
echo $ip
The followup echo indeed shows my correct ip address. The next lines of code are used to create my openvpn.conf file:
#create the server config file
ovpnsettings='
dev tun
server 10.10.10.0 255.255.255.0
port 443
ifconfig-pool-persist ipp.txt
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
push "route 10.10.10.0 255.255.255.0"
push "redirect-gateway"
push "dhcp-option DNS 8.8.8.8"
float
comp-lzo
keepalive 10 60
ping-timer-rem
persist-tun
persist-key
group nobody
crl-verify crl.pem
verb 4
log /var/openvpn.log
status openvpn-status.log
management $ip 5555
daemon'
echo "$ovpnsettings" > /etc/openvpn/openvpn.conf
Yet when I look at that file after it is written, the line near the bottom says:
management $ip 5555 and not management 192.168.1.1 5555 like I would expect it to. A subsequent echo $ip after this still shows the correct ip address being retained by the variable.
Any ideas of why this isn't working as expected?
Thanks
http://ift.tt/1dvHQ0Z
0 comments:
Post a Comment