On 17 Apr 2020, at 2:52, Ansgar Wiechers wrote: > On 2020-04-17 Bill Cole wrote: >> On 17 Apr 2020, at 0:57, Ranjan Maitra wrote: >>> On Mon, 23 Mar 2020 17:19:42 -0400 (EDT) Wietse Venema wrote: >>>> #!/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 >>> >>> 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? >> >> Make that line: >> >> *UP*) if [ "$prev" = up ] >> >> Also replace '-ne' in line 16 with '=' > > If I'm not mistaken, the '-ne' in both lines (10 & 16) should be '!='.
Oops, yes: YOU ARE CORRECT. -- Bill Cole b...@scconsult.com or billc...@apache.org (AKA @grumpybozo and many *@billmail.scconsult.com addresses) Not For Hire (currently)