[GLLUG] Help with a script..

Jean van Wyngaardt gabrieldrumming at gmail.com
Mon Jan 6 22:11:05 UTC 2014


Actually thats exactly what I worked out just before you emailed in. It makes perfect sense!

I ended up changing the below areas and it now works with perfect results:

____________________________

#!/bin/bash #instead of bin/sh which means the [[ ]] are now working without error
while [ "true" ]
do
    vpnck=$(nmcli con status uuid 3e46a1d0-ab02-4d69-bd36-31dfcc01af6d)
    if [[ "$vpnck" != *cryptocloud* ]]
    then
      (sleep 1s && nmcli con up uuid 3e46a1d0-ab02-4d69-bd36-31dfcc01af6d)
    fi
    sleep 20
done

_____________________________

I feel like I've accomplished a massive goal today, loads of thanks to all who helped! I need to do some more bashing.. :)

Jean 

Jean van Wyngaardt 

07599 428068 
info at jeangabriel.co.uk 
http://runlevel.co.uk 
http://mactribe.co.uk

On 6 Jan 2014, at 21:53, Iain M Conochie <iain at shihad.org> wrote:

> On 2014-01-06 20:17, Jean van Wyngaardt wrote:
>> Hey guys
>> 
>> Working out this VPN script and it won't run because of line 7
>> (highlighted in bold below). Seeing as my scripting knowledge is
>> limited, I thought I might check with you!
>> 
>> #!/bin/sh
>> while [ "true" ]
>> do
>> vpnck=$(nmcli con status uuid 3e46a1d0-ab02-4d69-bd36-31dfcc01af6d)
> instead of this
>> if [[ $vpnck == *cryptocloud* ]]
>> then
>> ELSE
> try this
>   if [[ $vpnchk != *cryptocloud* ]]
>   then
>> (sleep 1s && nmcli con up uuid 3e46a1d0-ab02-4d69-bd36-31dfcc01af6d)
>> fi
>> sleep 20
>> done
> 
> Since you are not looking for the true as you do not seem to want to do anything with that check for the false
> 
> Cheers
> 
> Iain
>> 
>> Jean
>> 
>> JEAN VAN WYNGAARDT
>> 
>> 07599 428068
>> info at jeangabriel.co.uk [1]
>> http://runlevel.co.uk [2]
>> http://mactribe.co.uk [3]
>> 
>> 
>> Links:
>> ------
>> [1] mailto:info at jeangabriel.co.uk
>> [2] http://runlevel.co.uk
>> [3] http://mactribe.co.uk
> 
> 
> _______________________________________________
> GLLUG mailing list
> GLLUG at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/gllug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20140106/5b2bd7f7/attachment.html>


More information about the GLLUG mailing list