[phpBB Debug] PHP Notice: in file /viewtopic.php on line 981: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 981: getdate(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead
Tynsoe Projects • View topic - bash script not working correctly in geektool

bash script not working correctly in geektool

bash script not working correctly in geektool

Postby peterv6 » Sat Aug 27, 2011 4:55 pm

I wrote the following bash script to use with geektool. It loops through ip addresses 192.168.1.1 to 192.168.1.7, does a ping on each, and if the command succeeds, it echos the ip address. When run in terminal, it works perfectly.


Code: Select all
#!/bin/bash
for ip in $(seq 1 7); do ping -c 1 192.168.1.$ip>/dev/null; [ $? -eq 0 ] &&
echo "192.168.1.$ip is UP" || echo "$? inactive ip $ip" ; done

The correct output (when run in terminal) if ips 1,3,4, & 5 are up,
and the others are inactive:
192.168.1.1 is UP
1 inactive ip 2
192.168.1.3 is UP
192.168.1.4 is UP
192.168.1.5 is UP
1 inactive ip 6
1 inactive ip 7

The incorrect output (when run in geektool):
192.168.1.1

The problem is that when I run this in geektool, it only displays the first active ip address it finds, then nothing. For some reason, when it encounters the first inactive ip address, geektool seems to stall. (It seems it's got to be something with geektool, otherwise the script wouldn't work correctly in terminal.)

If anyone can help me out, I'd be extremely grateful.
Peter V.
peterv6
 
Posts: 1
Joined: Sat Aug 27, 2011 4:34 pm

Return to GeekTool

Who is online

Users browsing this forum: No registered users and 2 guests

cron