On MY tivo, running tivowebplus and cojonesdetoro's runscript module, I can start vserver, look at the process number, and kill it using the input field and "kill <pid>"Originally Posted by PortlandPaw
Works fine....
Could somebody please tell me if it's possible to run a shell command from a tcl TivoWeb module? And, if so, how?
I can get a listing of processes running by doing this:
exec /var/hack/bin/ps x
...simple enough
But when I try to kill a process like this
exec kill 666
I get a "no such file or directory" error.
I've looked for the "kill" command in the directories, but no luck. I could call a .sh file, but I'd like to keep it clean.
Can anybody help?
David R. Hill............... TivoWeb Hack Manager
Chebeague Island........From the land of champions:
Casco Bay..................The Boston Red Sox
Maine........................The New England Patriots
58.5 gig HDR-112 since October, 2000
240 gig, 306 hours since January, 2004 (same machine)
120 gig DSR6000 DirecTiVo
"There are 10 kinds of people -- those who count in binary and those who don't."
On MY tivo, running tivowebplus and cojonesdetoro's runscript module, I can start vserver, look at the process number, and kill it using the input field and "kill <pid>"Originally Posted by PortlandPaw
Works fine....
Yes, and inspired by those efforts, I want to do the same thing from a TivoWeb module, only without looking up pids and entering commands. And I want to do it for all sorts of hacks. To be able to start and start them from a TivoWeb screen with just a click or two.
Got it all engineered and designed -- just this last little hurdle to get over. Can you help?
David R. Hill............... TivoWeb Hack Manager
Chebeague Island........From the land of champions:
Casco Bay..................The Boston Red Sox
Maine........................The New England Patriots
58.5 gig HDR-112 since October, 2000
240 gig, 306 hours since January, 2004 (same machine)
120 gig DSR6000 DirecTiVo
"There are 10 kinds of people -- those who count in binary and those who don't."
Sounds like the shell you're running doesn't have the 'kill' binary in the path. I keep mine in /var/hack/bin/kill. In my case, I would do:
/var/hack/bin/kill -9 PID
do an echo $PATH to see what is set. It may only set to paths in the rc boot scripts but not those changes set in in any root .login, .profile or .bashrc scripts. You might put a 'set PATH' statement in the script.
EDIT: Ugh.. I should have read your post better. I now see that you looked for the binary. Perhaps it is in a busybox link? Did you do 'find / | grep kill"?
how about this at the telnet shell prompt: which kill
Last edited by cojonesdetoro; 03-23-2004 at 12:44 AM.
perl -e 'print unpack("u","\@2\&\%V92\!Y;W4\@:&\%C:V5D(\%E/55\(\@5\&EV\;R\!T;V1A>3\\-\`"),"\n";'
I tried the "find" and the "which" commands from the bash prompt and got no response. From the tivosh prompt I got a "bad option" message and "command not found" respectively.
I would think I'd be able to make this work. Another clue: Trying to run a simple start command such as "exec /var/hack/bin/yac &" gives a "no such file or directory" when I try to run it from inside the tcl TivoWeb module.
So maybe it isn't just "kill." Maybe I need to do something to make any shell command work. Oddly enough, elsewhere in the program I read "/var/hack/bin/ps x" into a variable and it works fine.
Any ideas? I really appreciate your help. Here's what I'm working on -- you can see how far I've gotten -- everything else works!
http://web.nlis.net/~davehill/screenshot.jpg
p.s. Partial answer: Just figured out that exec doesn't work from within an html block -- has to come after html_end. Got the /var/hack type calls to work, but still no success on "kill."
Last edited by PortlandPaw; 03-23-2004 at 08:01 AM.
David R. Hill............... TivoWeb Hack Manager
Chebeague Island........From the land of champions:
Casco Bay..................The Boston Red Sox
Maine........................The New England Patriots
58.5 gig HDR-112 since October, 2000
240 gig, 306 hours since January, 2004 (same machine)
120 gig DSR6000 DirecTiVo
"There are 10 kinds of people -- those who count in binary and those who don't."
That looks like a very kool hack.
I bet Stuart hit the nail on the head. I have a kill binary on my box but the 'help' command shows all the bash built-in commands and, sure enough, this is there:
kill [-s sigspec | -n signum | -si
perl -e 'print unpack("u","\@2\&\%V92\!Y;W4\@:&\%C:V5D(\%E/55\(\@5\&EV\;R\!T;V1A>3\\-\`"),"\n";'
Thanks, guys! I knew I could count on sanderton and cojones to come through! I can't wait to get home and try it out. Trouble is, I've got a long day ahead and I won't see this project again much before 10:00 pm.
Stay tuned.
Dave
David R. Hill............... TivoWeb Hack Manager
Chebeague Island........From the land of champions:
Casco Bay..................The Boston Red Sox
Maine........................The New England Patriots
58.5 gig HDR-112 since October, 2000
240 gig, 306 hours since January, 2004 (same machine)
120 gig DSR6000 DirecTiVo
"There are 10 kinds of people -- those who count in binary and those who don't."
Forget about TivoWeb, forget about TCL, this is straight from a telnet bash prompt. You will notice that try as I might, I cannot kill YAC using the builtin bash kill command. It keeps telling me I'm doing something wrong. And what might that be???? I can kill it fine using "kill" without /bin/bash -c and I can do other /bin/bash commands such as "pwd." Try this on your TiVo and let's see if we can figure this out. I'm stumped.
Thanks,
Dave
=[tivo:root]-# ps x
...
...
169 p0 SW 0:00 bash
181 p0 SW 0:00 /var/hack/bin/yac
182 p0 RW 0:00 ps x
=[tivo:root]-# /bin/bash -c kill 181
kill: usage: kill [-s sigspec | -n signum | -sigspec] [pid | job]... or kill -l [sigspec]
=[tivo:root]-# /bin/bash -c kill 9 181
kill: usage: kill [-s sigspec | -n signum | -sigspec] [pid | job]... or kill -l [sigspec]
=[tivo:root]-# ps 181
PID TTY STAT TIME COMMAND
181 p0 SW 0:00 /var/hack/bin/yac
=[tivo:root]-#
David R. Hill............... TivoWeb Hack Manager
Chebeague Island........From the land of champions:
Casco Bay..................The Boston Red Sox
Maine........................The New England Patriots
58.5 gig HDR-112 since October, 2000
240 gig, 306 hours since January, 2004 (same machine)
120 gig DSR6000 DirecTiVo
"There are 10 kinds of people -- those who count in binary and those who don't."
Yep, i see it on mine a well.Originally Posted by PortlandPaw
try using quotes:
/bin/bash -c "kill 181"
should fix it.
The reason is that bash needs a string for the -c param, however it interprets everything after the 'kill' as more parameters and not as additional parts of the command string.
perl -e 'print unpack("u","\@2\&\%V92\!Y;W4\@:&\%C:V5D(\%E/55\(\@5\&EV\;R\!T;V1A>3\\-\`"),"\n";'
Only royalty and people with parasites are allowed to refer to themselves in the third person.. oh, wait.. That's second person isn't it?... nevermind.Originally Posted by sanderton
perl -e 'print unpack("u","\@2\&\%V92\!Y;W4\@:&\%C:V5D(\%E/55\(\@5\&EV\;R\!T;V1A>3\\-\`"),"\n";'
Thanks again, guys -- the quotes did the trick. There are still some differences between what you can do at the console level and how the interpreter handles commands, but I'm on the right track now. Watch for the results of my efforts soon, I hope.
David R. Hill............... TivoWeb Hack Manager
Chebeague Island........From the land of champions:
Casco Bay..................The Boston Red Sox
Maine........................The New England Patriots
58.5 gig HDR-112 since October, 2000
240 gig, 306 hours since January, 2004 (same machine)
120 gig DSR6000 DirecTiVo
"There are 10 kinds of people -- those who count in binary and those who don't."