View Full Version : uptime doesn't work ???
This may be a simple one, but I thought I'd ask anyway:
when i run uptime I get:
bash-2.02# uptime
uptime: couldn't get boot time
bash-2.02#
I checked /proc/uptime and there is definately info:
bash-2.02# cat /proc/uptime
160900.26 140777.32
bash-2.02#
Whats the deal? I saw something about backdoors being enabled?
I could also write a quick bash script to work with the into in /proc/uptime, but I figured I'd check with everyone before re-inventing the wheel.
*bump*
C'mon guys, no one else here is Nerd enough (like me) to want to know the uptime on their tivo's? :D
If others are having this problem, just let me know and I'll post a quick bash script that reports uptime.
BubbleLamp
01-06-2003, 12:56 PM
Who cares? ;) Seriously, just enable back doors, then look in System Information.
Yeah, I'm coming to that end (after being unable to find a static ppc version of expr, and being unable to cross compile my own....)
DarkWing
01-06-2003, 03:28 PM
There's already a script that'll tell you, EditTitle3.tcl
System Info, then Uptime.
I did this: (after a friend helped me remember bash math without expr)
#!/bin/bash
UPTIME=`cat /proc/uptime | cut -d"." -f1`
DAYS=$(($UPTIME / 86400))
DAYSREMAINDER=$(($UPTIME % 86400))
HOURS=$(($DAYSREMAINDER / 3600))
HOURSREMAINDER=$(($DAYSREMAINDER % 3600))
MINUTES=$(($HOURSREMAINDER / 60))
echo $DAYS days, $HOURS:$MINUTES
DarkWing
01-06-2003, 03:55 PM
Did you cut and paste that from your working script?
Mine doesn't like the ` character.
Also, I have no "cut" program on my dtivo, and are those supposed to be set commands?
More info please.
Yeah that's a cut and paste.
The backtick (`) tells the variable UPTIME to store the result of: cat /proc/uptime | cut -d"." -f1
rather than store the actual text: "cat /proc/uptime | cut -d"." -f1"
What do you get when you run it?
DarkWing
01-06-2003, 04:01 PM
bash-2.02# ./up
./up: ./up: /proc/uptime: Permission denied
cut: command not found
./up: / 86400: syntax error: operand expected (error token is "/ 86400")
./up: % 86400: syntax error: operand expected (error token is "% 86400")
./up: / 3600: syntax error: operand expected (error token is "/ 3600")
./up: % 3600: syntax error: operand expected (error token is "% 3600")
./up: / 60: syntax error: operand expected (error token is "/ 60")
days, :
bash-2.02#
It really doesn't like the backtick, I can't even type it in with joe, gives me an error in joe "Ctrl- (or 0-9 for dec. ascii, x for hex, or o for octal)"
bash-2.02# find . -name cut
./tivo-bin/cut
bash-2.02#
Could it be because I have installed Kraven's Update?
DarkWing
01-06-2003, 04:05 PM
bash-2.02# find . -name cut
bash-2.02#
Ah, must be Kraven's update that has cut.
DarkWing
01-06-2003, 04:06 PM
Do you use irc? :)
I'm all for up'ing my post count, but not like this, lol.
lgkahn
04-01-2004, 07:57 PM
for anyone else searching on this thread that is becuse you were running the command wrong.. since the command is on the tivo box you may as well run it correctly
ie
you dont just run uptime or it looks for the uptime file in the default location which is not /proc/uptime but /var/log/utmp
ie..
tivo:/bin$ uptime
uptime: /var/run/utmp: No such file or directory
tivo:/bin$
tivo:/bin$ uptime /proc/uptime
11:55pm up 1 day, 3:32, 0 users, load average: 4.53, 4.37, 3.19
tivo:/bin$
tivo:/bin$
tivo:/bin$ uptime --help
Usage: uptime [OPTION]... [ FILE ]
Output who is currently logged in according to FILE.
If FILE is not specified, use /var/run/utmp. /var/log/wtmp as FILE is common.
--help display this help and exit
--version output version information and exit
Report bugs to sh-utils-bugs@gnu.ai.mit.edu
TheWickedPriest
04-01-2004, 09:56 PM
I just put a line in my rc.sysinit, "touch /var/run/utmp", to make uptime work.
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.