[Asterisk-Users] vserver (Debian) - no tty: howto use /usr/sbin/safe_asterisk with "-c" for color CLI?

Tzafrir Cohen tzafrir.cohen at xorcom.com
Sat Jul 8 08:12:40 MST 2006


On Sat, Jul 08, 2006 at 12:34:42PM +0200, Robert Michel wrote:
> Salve Tzafrir, *!
> 
> Thank you for your kindly (and good) support. :)
> 
> I found a solution for me to get a colored CLI on a
> vserver, but to publish it for other *-users,
> I feel it must be smarter ;)
> 
> On Tue, 04 Jul 2006, Tzafrir Cohen wrote:
> > safe_asterisk has a flawed logic: it assumes that the tty device will
> > always exist. Thus it is not suited for use with screen.
> > 
> > However wouldn't it be better to tell asterisk to have colors even in a
> > remote terminal unless you use -n?
> 
> On the longterm this is interesting, thank you for the patch,
> I will test it in the next time...
> But I do have a more general aim, to find a solution to 
> to cope with the restriction of vserver that root at guest
> can't create new terminals with mknode.
> 
> I personaly could life with an asterisk patch, or manualy
> solution that works only until the next crash - but I'm
> keen to find and promote a solution that would also help
> vserver usersers in other cases and that would be working
> without the support of root at host, the vserver provider.
> 
> root at guest := root of one vserver (guest)
> root at host  := root/admin of the sytem that serve the
>               different vserver instances
> 
> 
> On the vserer mailinglist I do also have a discussion
> with Herbert Poetzl (vsever developer) and I wrote
> to that list:
> 
>  Well I like the "one task, one tool" philosophy,
>  or just the slogan "Devide et impera!" So I'm not
>  happy with the need to modificate asterisk scripts 
>  or binary to run on a vserver.... remember in May
>  someone ask here on the list for the power to
>  create a fix terminal to use with perl.
> 
>  But you are right, there are options for root at guest
>  to work around. My skripting skills are not so high
>  and my try would be better inside the asterisk scripts
>  for shure - but I'm looking for a solution that is
>  indepentend of the task - finaly it should be
>  a skript/demon that request a pseudo terminal
>  and link this to a fix /dev/tty$n ($n choosen by
>  root at guest). 
>  The most perfect solution would be maybe, when
>  this pseudotty process take care that his "device"
>  exist and if not, that it is created again.
> 
>  ############################################
>  Howto creat a /dev/tty9 on a vserver without
>  the right to use mknode,
>  proposed by news at robertmichel.de 2006.07.07
>  ############################################
> 
>  Create two files:
>     /dev/init.d/pseudo-tty9
>     #!/usr/bin/expect -f
>     # Some software likes to have an own terminal
>     # but no function to request a pseudo terminal.
>     # On some vservers exist no or not enough 
>     # tty devices, and root at guest does not have the
>     # power to create some with mknode.
>     # The idea of this script is to run a bash
>     # as the user asterisk and detach it.
>     #
>     # expect "#" and "$" are part of the promt ;)2006
>     # 2006.07.07 by news at RobertMichel.de
> 
>     spawn dtach -A /tmp/pseudoterm.socket.9 -e a bash
>     expect "#" { send "/etc/init.d/pseudo-tty9-ln.sh\r" }
>     expect "#" { send "su - asterisk\r" } 
>     expect "$" { send "a" }
>     #EOF
> 
>  And:
>     /etc/init.d/pseudo-tty9-ln.sh
>     #!/bin/bash
> 
>     ln -sf $(tty) /dev/tty9
>     #EOF
> 
>  and run then:
>      update-rc.d -n pseudotty9 defaults
>  as well as:
>      /dev/init.d/pseudo-tty9

And what happens when your current ssh session terminates and the sshd
destoys its current pty? Will asterisk just hang?

Also, creating a process that gives a full shell access without asking
too many questions is probably not the best idea.

If you want to create your own independent terminal device, use screen.

-- 
Tzafrir Cohen      sip:tzafrir at local.xorcom.com
icq#16849755       iax:tzafrir at local.xorcom.com
+972-50-7952406           
tzafrir.cohen at xorcom.com  http://www.xorcom.com



More information about the asterisk-users mailing list