kornerr has asked for the wisdom of the Perl Monks concerning the following question:

Hello.

I'm using IO::Pty::Easy to run an interactive shell (namely "omshell") within my script. IO::Pty::Easy works fine on the same machine. But when I try to launch "/usr/bin/omshell" when I connect to my script over xinetd, IO::Pty::Easy just complains it can't run "/usr/bin/omshell".

Can anyone suggest any way to solve this?
  • Comment on Cannot use IO::Pty::Easy from within xinetd

Replies are listed 'Best First'.
Re: Cannot use IO::Pty::Easy from within xinetd
by Khen1950fx (Canon) on Jul 02, 2010 at 06:30 UTC
    If xinetd is properly configured, and everything is setup correctly, then run
    /sbin/chkconfig --list | grep -i omshell
    If the response is no output, then it's not setup, and you'll need to enter the file for omshell in /etc/xinetd.d. It would help if you posted some code.
      Here's the complete example of the script:
      #!/usr/bin/perl use strict; use warnings; use IO::Pty::Easy; # Get stdin when this char is found (Telnet). $/ = "\n"; # Autoflush, write without buffering (Telnet). $| = 1; # Main loop. undef $_; my $quit = 0; my $input; my $pty = IO::Pty::Easy->new(); do { $input = <STDIN>; # Remove trailing new line character. $input =~ s/\r//g; $input =~ s/\n//g; eval { if ($input =~ /quit/) { $quit = 1; } elsif ($input =~ /run/) { my $st = $pty->spawn("/usr/bin/omshell"); die "Cannot run /usr/bin/omshell" unless ($st); } else { reply(help()); } }; reply($@) if ($@); print "> "; } while (!$quit); sub help { #--------------------------------------------------------------------- +---------| return qq{ quit run Launch app over IO::Pty::Easy. }; } # Reply to user. sub reply { print shift, "\n"; }
      If you run that with xinetd you will find out that subprocess cannot be launched.