Results 1 to 13 of 13

Thread: Shell Command from a TivoWeb module

  1. #1
    Join Date
    Jan 2004
    Location
    Chebeague Island, Maine
    Posts
    812

    Shell Command from a TivoWeb module

    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."

  2. #2
    Join Date
    Jan 2002
    Location
    New York
    Posts
    2,407
    Quote Originally Posted by PortlandPaw
    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?
    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>"

    Works fine....

  3. #3
    Join Date
    Jan 2004
    Location
    Chebeague Island, Maine
    Posts
    812
    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."

  4. #4
    Join Date
    Jul 2003
    Posts
    769
    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";'

  5. #5
    Join Date
    Jan 2004
    Location
    Chebeague Island, Maine
    Posts
    812
    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."

  6. #6
    Join Date
    Jun 2003
    Location
    Somerset, England
    Posts
    1,124
    Isn't kill a bash built-in command?

    try

    exec /sbin/bash -c kill -9 123
    Stuart

    Newbies - see if your questions are answered here Experts - can you add to the knowledge stored here? Developers - are your hacks listed here?

  7. #7
    Join Date
    Jul 2003
    Posts
    769
    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";'

  8. #8
    Join Date
    Jan 2004
    Location
    Chebeague Island, Maine
    Posts
    812
    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."

  9. #9
    Join Date
    Jan 2004
    Location
    Chebeague Island, Maine
    Posts
    812

    OK, this is driving me nuts...

    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."

  10. #10
    Join Date
    Jul 2003
    Posts
    769
    Quote Originally Posted by PortlandPaw
    =[tivo:root]-# /bin/bash -c kill 181
    Yep, i see it on mine a well.
    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";'

  11. #11
    Join Date
    Jun 2003
    Location
    Somerset, England
    Posts
    1,124
    Works fine with the quotes. Serves me right for trying to advise peopel on Linux syntax. Know your limits Stuart...
    Stuart

    Newbies - see if your questions are answered here Experts - can you add to the knowledge stored here? Developers - are your hacks listed here?

  12. #12
    Join Date
    Jul 2003
    Posts
    769
    Quote Originally Posted by sanderton
    Know your limits Stuart...
    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.
    perl -e 'print unpack("u","\@2\&\%V92\!Y;W4\@:&\%C:V5D(\%E/55\(\@5\&EV\;R\!T;V1A>3\\-\`"),"\n";'

  13. #13
    Join Date
    Jan 2004
    Location
    Chebeague Island, Maine
    Posts
    812
    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."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •