Re: ssh::command

2018-02-13 Thread Chas. Owens
Can you simplify your code to a short program that had the issue and post it? Often the act of shortening the program reveals the problem on its own. On Mon, Feb 12, 2018, 22:37 Lancelot Mak wrote: > Hi all, > I am using SSH::Command module to do ssh stuff but it does not return > full reply

Re: ssh::command

2018-02-13 Thread Lancelot Mak
#!/usr/bin/perl -W use SSH::Command; $cmdln = `grep $ARGV[0] list.txt`; chomp($cmdln); ($cmdhost,$user,$pass) = split(':',$cmdln); $p = `echo $pass|base64 -d`; chomp($p); $cmdlog = ssh_execute( host => $cmdhost, username => $user, password => $p, command => "$ARGV[1]", ); print $cmdlog; print

Checking if a website is up doesn't work correctly

2018-02-13 Thread Manfred Lotz
Hi there, Somewhere I found an example how to check if a website is up. Here my sample: #! /usr/bin/perl use strict; use LWP::Simple; my $url="https://notabug.org";; if (! head($url)) { die "$url is DOWN" } Running above code I get https://notabug.org is DOWN at ./check_url.pl l

Re: Checking if a website is up doesn't work correctly

2018-02-13 Thread Shlomi Fish
Hi Manfred! On Tue, 13 Feb 2018 12:25:31 +0100 Manfred Lotz wrote: > Hi there, > Somewhere I found an example how to check if a website is up. > > Here my sample: > > #! /usr/bin/perl > > use strict; > > use LWP::Simple; > my $url="https://notabug.org";; > if (! head($url)) { > die "$url

Re: ssh::command

2018-02-13 Thread Shlomi Fish
Hi Lancelot, some comments on your code: On Tue, 13 Feb 2018 17:19:03 +0800 Lancelot Mak wrote: > #!/usr/bin/perl -W > 1. don't use -w - http://perl-begin.org/tutorials/bad-elements/#the-dash-w-flag 2. use strict and warnings instead. > use SSH::Command; > > $cmdln = `grep $ARGV[0] list.tx

Re: ssh::command

2018-02-13 Thread Chas. Owens
On Tue, Feb 13, 2018 at 1:19 AM Lancelot Mak wrote: > #!/usr/bin/perl -W > > use SSH::Command; > > $cmdln = `grep $ARGV[0] list.txt`; > chomp($cmdln); > ($cmdhost,$user,$pass) = split(':',$cmdln); > $p = `echo $pass|base64 -d`; > chomp($p); > > $cmdlog = ssh_execute( > host => $cmdhost, > usernam

Re: Checking if a website is up doesn't work correctly

2018-02-13 Thread Andy Bach
The site doesn't like 'head' requests? get works #!/usr/bin/perl use strict; use warnings; use LWP::Simple; # my $url="https://shlomif.github.io/";; my $url="http://www.notabug.org/";; print "$url is ", ( (! get($url)) ? "DOWN" : "up"

Re: Checking if a website is up doesn't work correctly

2018-02-13 Thread Manfred Lotz
On Tue, 13 Feb 2018 10:47:42 -0600 Andy Bach wrote: > The site doesn't like 'head' requests? get works > #!/usr/bin/perl > > use strict; > use warnings; > > use LWP::Simple; > # my $url="https://shlomif.github.io/";; > my $url="http://www.notabug.org/";; > print "$url is ", ( >

Re: Checking if a website is up doesn't work correctly

2018-02-13 Thread Andy Bach
$ wget http://scripts.sil.org/OFL --2018-02-13 13:42:50-- http://scripts.sil.org/OFL Resolving scripts.sil.org (scripts.sil.org)... 209.12.63.143 Connecting to scripts.sil.org (scripts.sil.org)|209.12.63.143|:80... connected. HTTP request sent, awaiting response... 302 Found Location: http://scrip

Re: Checking if a website is up doesn't work correctly

2018-02-13 Thread Manfred Lotz
On Tue, 13 Feb 2018 13:50:55 -0600 Andy Bach wrote: > $ wget http://scripts.sil.org/OFL > --2018-02-13 13:42:50-- http://scripts.sil.org/OFL > Resolving scripts.sil.org (scripts.sil.org)... 209.12.63.143 > Connecting to scripts.sil.org (scripts.sil.org)|209.12.63.143|:80... > connected. > HTTP r

Re: Checking if a website is up doesn't work correctly

2018-02-13 Thread Andy Bach
> Is there another tool I could use for checking? I mean some tool in the Perl universe? Well, lwp-dump is a perl util - comes w/ LWP I believe. The sil.org, for one, just returns forbidden/403 for their own policy reasons, but as far as your "is it up?" question, that should be answer enough. It

Re: ssh::command

2018-02-13 Thread Lancelot Mak
do u have any recommendation on module to use? what i wanted is to login ssh using username,password but in script no key, no non-interactive thanks On 13 February 2018 at 23:38, Chas. Owens wrote: > On Tue, Feb 13, 2018 at 1:19 AM Lancelot Mak > wrote: > >> #!/usr/bin/perl -W >> >> use SSH::C

Re: ssh::command

2018-02-13 Thread Илья Рассадин
Try to look at Net::SSH::Any https://metacpan.org/pod/Net::SSH::Any On 2/14/18 5:32 AM, Lancelot Mak wrote: do u have any recommendation on module to use? what i wanted is to login ssh using username,password but in script no key, no non-interactive thanks On 13 February 2018 at 23:38, Chas.

Re: ssh::command

2018-02-13 Thread Lancelot Mak
thanks for the help. it works. On 14 February 2018 at 13:33, Илья Рассадин wrote: > Try to look at Net::SSH::Any https://metacpan.org/pod/Net::SSH::Any > > > On 2/14/18 5:32 AM, Lancelot Mak wrote: > > do u have any recommendation on module to use? what i wanted is to login > ssh using username,