Problems configuring ifstated with dhcp interfaces /etc/ifstated.conf:4: macro '2' not defined

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems configuring ifstated with dhcp interfaces /etc/ifstated.conf:4: macro '2' not defined

C. L. Martinez
Hi all,

 I need to configure ifstated for two public interfaces and one of them is a dhcp interface. To accomplish this I have configured the following macro in ifcstated.conf's file:

wired_gate_test = '( "ping -q -c1 -w1 -I `awk '/fixed-address/ { print $2 }' /var/db/dhclient.leases.em1 | sed -e 's/;//'` `awk '/routers/ { print $3 }' /var/db/dhclient.leases.em1 | sed -e 's/;//'` > /dev/null" every 30 )'

 But it returns the following error:

wired_linkup = "em1.link.up"
wireless_linkup = "em2.link.up"
/etc/ifstated.conf:4: syntax error
/etc/ifstated.conf:4: macro '2' not defined
/etc/ifstated.conf:34: macro 'wired_gate_test' not defined
/etc/ifstated.conf:34: syntax error
ifstated: invalid start state wired

 From command line, ping command works ... What am I doing wrong?

Thanks.

--
Greetings,
C. L. Martinez

Reply | Threaded
Open this post in threaded view
|

Re: Problems configuring ifstated with dhcp interfaces /etc/ifstated.conf:4: macro '2' not defined (SOLVED)

C. L. Martinez
On Fri, Nov 10, 2017 at 07:28:19PM +0000, C. L. Martinez wrote:

> Hi all,
>
>  I need to configure ifstated for two public interfaces and one of them is a dhcp interface. To accomplish this I have configured the following macro in ifcstated.conf's file:
>
> wired_gate_test = '( "ping -q -c1 -w1 -I `awk '/fixed-address/ { print $2 }' /var/db/dhclient.leases.em1 | sed -e 's/;//'` `awk '/routers/ { print $3 }' /var/db/dhclient.leases.em1 | sed -e 's/;//'` > /dev/null" every 30 )'
>
>  But it returns the following error:
>
> wired_linkup = "em1.link.up"
> wireless_linkup = "em2.link.up"
> /etc/ifstated.conf:4: syntax error
> /etc/ifstated.conf:4: macro '2' not defined
> /etc/ifstated.conf:34: macro 'wired_gate_test' not defined
> /etc/ifstated.conf:34: syntax error
> ifstated: invalid start state wired
>
>  From command line, ping command works ... What am I doing wrong?
>
> Thanks.
>
Oops .. I have the problem ... I need to escape awk like awk \'/fixed... Sorry for the noise ...

--
Greetings,
C. L. Martinez