/[psinib]/psinib.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /psinib.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by dpavlin, Sun Oct 12 17:44:21 2003 UTC revision 1.14 by dpavlin, Sun Oct 12 18:47:35 2003 UTC
# Line 24  use Filesys::SmbClient; Line 24  use Filesys::SmbClient;
24  use Fcntl qw(LOCK_EX LOCK_NB);  use Fcntl qw(LOCK_EX LOCK_NB);
25  use Digest::MD5;  use Digest::MD5;
26  use File::Basename;  use File::Basename;
27    use Getopt::Long;
28    
29  # configuration  # configuration
30  my $LOG_TIME_FMT = '%Y-%m-%d %H:%M:%S'; # strftime format for logfile  my $LOG_TIME_FMT = '%Y-%m-%d %H:%M:%S'; # strftime format for logfile
# Line 58  my $c = 0; Line 59  my $c = 0;
59  # taint path: nmblookup should be there!  # taint path: nmblookup should be there!
60  $ENV{'PATH'} = "/usr/bin:/bin";  $ENV{'PATH'} = "/usr/bin:/bin";
61    
62    my $use_ping = 1;       # deault: use ping to verify that host is up
63    
64    my $result = GetOptions(
65            "ping!" => \$use_ping, "backupdest!" => \$BACKUP_DEST,
66    );
67    
68  my $mounts = shift @ARGV ||  my $mounts = shift @ARGV ||
69          'mountscript';          'mountscript';
70  #       die "usage: $0 mountscript";  #       die "usage: $0 mountscript";
# Line 65  my $mounts = shift @ARGV || Line 72  my $mounts = shift @ARGV ||
72    
73  my @in_backup;  # shares which are backeduped this run  my @in_backup;  # shares which are backeduped this run
74    
75  my $p = new Net::Ping->new("tcp", 2);  my $ping;
76  # ping will try tcp connect to netbios-ssn (139)  if ($use_ping) {
77  $p->{port_num} = getservbyname("netbios-ssn", "tcp");          $ping = new Net::Ping->new("tcp", 2);
78            # ping will try tcp connect to netbios-ssn (139)
79            $ping->{port_num} = getservbyname("netbios-ssn", "tcp");
80    }
81    
82  my $backup_ok = 0;  my $backup_ok = 0;
83    
# Line 129  while(<M>) { Line 139  while(<M>) {
139    
140          if ($ip) {          if ($ip) {
141                  xlog($share,"IP is $ip");                  xlog($share,"IP is $ip");
142                  if ($p->ping($ip)) {                  if (($use_ping && $ping->ping($ip)) || 1) {
143                          if (snap_share($share,$user,$passwd,$workgroup)) {                          if (snap_share($share,$user,$passwd,$workgroup)) {
144                                  $backup_ok++;                                  $backup_ok++;
145                          }                          }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.26