1

Trying to display an image when I am connected to the internet and another when I am not, I managed to come up with this 2 geeklet system:

1 shell:

if curl -f -s http://google.com > /dev/null ; then cp      /Users/mike/Documents/net.png /tmp/connstatus.png ; /Users/mike/Documents/noNet.png /tmp/connstatus.png ; fi ;

2 Image: pointing to /tmp/connstatus.png

It does not work. Thanks in andvace

Miguel
  • 310
  • 1
  • 5
  • 17

1 Answers1

1

You are missing else statement in your if:

if curl -f -s http://google.com > /dev/null
then 
  cp /Users/mike/Documents/net.png /tmp/connstatus.png
else
  cp /Users/mike/Documents/noNet.png /tmp/connstatus.png
fi
baf
  • 4,531
  • 1
  • 21
  • 24
  • Thank you very much for your input but it does not seem to work, no image displays – Miguel May 08 '15 at 11:26
  • Once again, thanks for the help, yes it does you were right, the image changes, its just the path on the second geeklet thats glitchy, im pointing it to /private/tmp/connstatus.png, but the image on the desktop doesn't show – Miguel May 08 '15 at 12:26
  • `/private/tmp` is not the same as `/tmp`, they are different paths. – l'L'l May 08 '15 at 12:28
  • Yes instead of typing the path to it i just used the wizard to get there, works perfectly, thanks! – Miguel May 08 '15 at 12:32