1
|
#!/usr/bin/perl
|
2
|
|
3
|
# All rights reserved and Copyright (c) 2020 Origo Systems ApS.
|
4
|
# This file is provided with no warranty, and is subject to the terms and conditions defined in the license file LICENSE.md.
|
5
|
# The license file is part of this source code package and its content is also available at:
|
6
|
# https://www.origo.io/info/stabiledocs/licensing/stabile-open-source-license
|
7
|
|
8
|
$ENV{PATH} = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin';
|
9
|
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
|
10
|
my $PING = "arping -c2 -w4 -C1";
|
11
|
my $if = $ARGV[0];
|
12
|
$if = $1 if ($if =~ /(.+)/);
|
13
|
my $host = $ARGV[1];
|
14
|
$host = $1 if ($host =~ /(.+)/);
|
15
|
|
16
|
# Setting real UID: $< to UID: $>
|
17
|
$< = $>;
|
18
|
|
19
|
my $cmd = "$PING -I $if $host"; # >/dev/null 2>/dev/null
|
20
|
my $res = `$cmd`;
|
21
|
#if ($res =~ /0 response/) {
|
22
|
print $res;
|
23
|
if ($?) {
|
24
|
print "FAIL\n";
|
25
|
exit 1;
|
26
|
} else {
|
27
|
print "SUCCESS\n";
|
28
|
exit 0;
|
29
|
}
|