On Mon, 23 Mar 2020 17:19:42 -0400 (EDT) Wietse Venema <wie...@porcupine.org> 
wrote:

> Corrected code follows (missing do/done).
>
> Save to file, chmod +x  name-of-file, don't run this script from
> cron.
>
> It needs to be started at boot time, or before you make a VPN
> connection.
>
> #!/bin/sh
>
> while :
> do
>     ifconfig xxx | egrep 'UP|DOWN'
>     sleep 2
> done | while read status
> do
>     case "$status" in
>   *UP*) if [ "$prev" -ne up ]
>         then
>             prev=up
>             postconf -X defer_transports
>             postfix reload
>         fi;;
>      *) if [ "$prev" -ne down ]
>         then
>             prev=down
>             postconf defer_transports=smtp
>             postfix reload
>         fi;;
>     esac
> done
>
>         Wietse
>


Hi,

Sorry to bring this up after a while, but I have been trying this code, but 
seem to hit a syntax error:

line 10: [: : integer expression expected


Line10: is  the following line:

  *UP*) if [ "$prev" -ne up ]

Any help?

Many thanks,
Ranjan

Reply via email to