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

Can anyone tell me why the command does not run on the remote shell it simply echos the commnand to the log.
my $th = new Net::Telnet (Timeout => 5, #Errmode => 'die', input_log => 'telnet_prompt.log', Prompt => '/$username?/'); $th->open("$server"); $th->login("$user", "$unixpass"); @lines = $th->cmd("backup_sybase.pl Server.Name=$instance Backup.Datab +ase=$cltdb"); print @lines;

Replies are listed 'Best First'.
Re: The cmd sent to the remote telnet will not run
by sedhed (Scribe) on Aug 02, 2002 at 20:07 UTC

    I'm going to guess that it's one of two things:

    • Your prompt setting is not being matched. (Did you mean to use both $user and $username in your code?) You can use the dump_log() method to check for this stuff.
    • The literal command backup_sybase.pl is not found. Perhaps you need to give it a path such as ./backup_sybase.pl or maybe /usr/local/something/backup_sybase.pl?

    Also, I could very well be wrong, but my take on the docs is that you want the prompt() setting to match the whole prompt, not just a portion of it.

    cheers!

      I added a waitfor and it seems to work fine. Thanks
Re: The cmd sent to the remote telnet will not run
by JayBonci (Curate) on Aug 02, 2002 at 19:57 UTC
    Are you working under use strict? My first question would be to ask why you are looking for a prompt with $username, and you log in with $user. But that's the only thing I'd see off the top of my head.

    Good luck

        --jb
Re: The cmd sent to the remote telnet will not run
by BorgCopyeditor (Friar) on Aug 02, 2002 at 20:00 UTC

    Maybe because you're not assigning anything to the key "#Errmode" ... the pound sign introduces a comment. You'll have to escape it.

    BCE
    --Your punctuation skills are insufficient!