--- psinib.pl 2003/10/12 17:44:21 1.13 +++ psinib.pl 2003/10/12 18:47:35 1.14 @@ -24,6 +24,7 @@ use Fcntl qw(LOCK_EX LOCK_NB); use Digest::MD5; use File::Basename; +use Getopt::Long; # configuration my $LOG_TIME_FMT = '%Y-%m-%d %H:%M:%S'; # strftime format for logfile @@ -58,6 +59,12 @@ # taint path: nmblookup should be there! $ENV{'PATH'} = "/usr/bin:/bin"; +my $use_ping = 1; # deault: use ping to verify that host is up + +my $result = GetOptions( + "ping!" => \$use_ping, "backupdest!" => \$BACKUP_DEST, +); + my $mounts = shift @ARGV || 'mountscript'; # die "usage: $0 mountscript"; @@ -65,9 +72,12 @@ my @in_backup; # shares which are backeduped this run -my $p = new Net::Ping->new("tcp", 2); -# ping will try tcp connect to netbios-ssn (139) -$p->{port_num} = getservbyname("netbios-ssn", "tcp"); +my $ping; +if ($use_ping) { + $ping = new Net::Ping->new("tcp", 2); + # ping will try tcp connect to netbios-ssn (139) + $ping->{port_num} = getservbyname("netbios-ssn", "tcp"); +} my $backup_ok = 0; @@ -129,7 +139,7 @@ if ($ip) { xlog($share,"IP is $ip"); - if ($p->ping($ip)) { + if (($use_ping && $ping->ping($ip)) || 1) { if (snap_share($share,$user,$passwd,$workgroup)) { $backup_ok++; }