[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 - battery time..

battery time..

Re: 2 "commands" in one line...?

Postby ybizeul » Tue May 18, 2010 6:32 am

Same thing as the other thread, please give me a sample of the exact output you're expecting.
ybizeul
Site Admin
 
Posts: 133
Joined: Fri Jan 22, 2010 4:34 pm

Re: battery time..

Postby rudeboy » Tue May 18, 2010 12:09 pm

here't what i'm going for:

Uptime : x hours xx mins, x user (username)
RAM : x Gi total, xx Gi/Mb free
Macintosh HD : xx Gi total, xx Gi used, xx free
Battery : xx %, x hours xx mins
External IP: xx.xx.xxx.xxx


tks.
rudeboy
 
Posts: 18
Joined: Sun May 09, 2010 3:33 pm

Re: 2 "commands" in one line...?

Postby rudeboy » Tue May 18, 2010 12:10 pm

ybizeul wrote:Same thing as the other thread, please give me a sample of the exact output you're expecting.


it's actually in the same output, see other thread where i posted what exactly i am shooting for.. tks.
rudeboy
 
Posts: 18
Joined: Sun May 09, 2010 3:33 pm

Re: battery time..

Postby ybizeul » Tue May 18, 2010 12:39 pm

Quick & Dirty (not musch time :-))
Code: Select all
printf "%s, %i user(s) (%s)\n" "`uptime|sed -E 's/.* up (.*,.*),.*users.*/\1/'`" `w -h|awk '{print $1}'|uniq|wc -l` "`w -h|awk '{print $1}'|uniq|sed 's/\n//g'`";top -l 1 | awk '/PhysMem/ {print "RAM : " $6 " + " $10 " "}';df -h | grep disk0s2 | awk '{print "Mac HD:", $2, "total,", $3, "used,", $4, "remaining"}';printf "Battery : %s, %s" "`pmset -g ps  |  sed -n 's/.*[[:blank:]]+*\(.*%\).*/\1/p'`";MIN=`ioreg -rn AppleSmartBattery | awk "/TimeRemaining/"'{ print $3 }'`;H=$(( $MIN / 60 ));M=$(( $MIN - $MIN / 60 * 60 ));printf "%i:%.02i\n" $H $M;echo External IP: `curl -s http://checkip.dyndns.org/ | sed 's/[a-zA-Z<>/ :]//g'`
ybizeul
Site Admin
 
Posts: 133
Joined: Fri Jan 22, 2010 4:34 pm

Re: battery time..

Postby rudeboy » Tue May 18, 2010 12:54 pm

almost :}
Image

don't need the time, and tried changing "up" to "Uptime" but it doesn't change.... (also no real need for load averages unless i can figure out what they mean :}

(and there's an extra space, first line)

THANKS.
rudeboy
 
Posts: 18
Joined: Sun May 09, 2010 3:33 pm

Re: battery time..

Postby ybizeul » Tue May 18, 2010 5:31 pm

Ok, this is because you have < 1 day of uptime, I did not want to reboot my machine to see the output of the uptime command if less than a day.

Code: Select all
printf "%s, %i user(s) (%s)\n" "`uptime|sed 's/.* up \(.*\), .*, .*/\1/'`" `w -h|awk '{print $1}'|uniq|wc -l` "`w -h|awk '{print $1}'|uniq|sed 's/\n//g'`";top -l 1 | awk '/PhysMem/ {print "RAM : " $6 " + " $10 " "}';df -h | grep disk0s2 | awk '{print "Mac HD:", $2, "total,", $3, "used,", $4, "remaining"}';printf "Battery : %s, %s" "`pmset -g ps  |  sed -n 's/.*[[:blank:]]+*\(.*%\).*/\1/p'`";MIN=`ioreg -rn AppleSmartBattery | awk "/TimeRemaining/"'{ print $3 }'`;H=$(( $MIN / 60 ));M=$(( $MIN - $MIN / 60 * 60 ));printf "%i:%.02i\n" $H $M;echo External IP: `curl -s http://checkip.dyndns.org/ | sed 's/[a-zA-Z<>/ :]//g'`
ybizeul
Site Admin
 
Posts: 133
Joined: Fri Jan 22, 2010 4:34 pm

Re: battery time..

Postby rudeboy » Tue May 18, 2010 8:33 pm

yea, i turn my Mac off at night and back on in the morning :} it's working and i'm trying to add "Uptime" but inserting regular text is never working for me, tried echo and print :]

(ps. where the output start there's a space, might be resolved when i add the "Uptime" text)
rudeboy
 
Posts: 18
Joined: Sun May 09, 2010 3:33 pm

Re: battery time..

Postby ybizeul » Wed May 19, 2010 9:55 pm

Here the printf part is the key. Add anything you want in there, %x values are substitute with what's following that string to the end of the line. I don't see where the extra space come from.

Could you post another screenshot ?
ybizeul
Site Admin
 
Posts: 133
Joined: Fri Jan 22, 2010 4:34 pm

Re: battery time..

Postby rudeboy » Thu May 20, 2010 1:56 am

thanks, i added the word "Uptime" with no problem...

regarding the extra space, it's only there (i think) when the pc is up for less than 10 minutes... i must double check this.

all in all, in case i haven't said this GREAT support for a AWESOME app.
rudeboy
 
Posts: 18
Joined: Sun May 09, 2010 3:33 pm

Previous

Return to GeekTool

Who is online

Users browsing this forum: No registered users and 2 guests

cron