Hi, Ty.

On Tuesday, 22 April 2014 22:34:29 -0700,
ty wrote:

> Perhaps this will work?
> #!/bin/bash
> echo 1 #Non Logged Commands
> echo 2
> echo 3
> echo 4
> (
> set -x
> echo 5 #Logged Commands
> echo 6
> echo 7
> echo 8
> ) 2>> log
> echo 9 #Non Logged Commands
> echo 10
> 
> Output of terminal:
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
> 
> Output of log:
> ++ echo 5
> ++ echo 6
> ++ echo 7
> ++ echo 8

This seems to be what I need. Although in some parts of the script, I am
getting an "ambiguous redirect".


 87       ### Add routes ###
 88       $ECHO "Applying rules for simultaneous routing..."
 89       (
 90         set -x
 91         $IP route add ${VPN_NET[$N]} dev ${VPN_IFACE[$N]} src ${VPN_IP[$N]} 
table $N
 92         $IP route add default via ${VPN_GW[$N]} table $N
 93 
 94         $IP route add ${VPN_NET[$N]} dev ${VPN_IFACE[$N]} src ${VPN_IP[$N]}
 95 
 96         $IP rule add from ${VPN_IP[$N]} table $N
 97       ) 2>> ${VPN_APP_LOG[$N]}
 98       $ECHO 
=============================================================================
 99       ### Add routes ###
100     done
101
102     ### We make balancing between the two VPNs ###
103     $ECHO "Applying rules for balancing..."
104 
105     $ECHO "We removed the default route on the server..."
106     (
107       set -x
108       $IP route del default via 162.252.86.177
109     ) 2>> ${VPN_APP_LOG[$N]}
110     $ECHO "...and we distribute outbound traffic between the two VPNs..."
111     (
112       set -x
113       $IP route add default scope global \
114                 nexthop via ${VPN_IP[1]} dev ${VPN_IFACE[1]} weight 1 \
115                 nexthop via ${VPN_IP[2]} dev ${VPN_IFACE[2]} weight 1
116     ) 2>> ${VPN_APP_LOG[$N]}
117     ### We make balancing between the two VPNs ###
118 fi

For example, I am getting this error on line 118, but previous run
smoothly.


Thanks for responding.


Regards,
Daniel
-- 
Ing. Daniel Bareiro - GNU/Linux registered user #188.598
Proudly running Debian GNU/Linux with uptime:
09:33:11 up 76 days, 11:59, 19 users,  load average: 1,09, 1,19, 1,16

Attachment: signature.asc
Description: Digital signature

Reply via email to