]> git.donarmstrong.com Git - bin.git/blobdiff - sshsendmail
use timeout
[bin.git] / sshsendmail
index 081f0e3caa39cdb1a1d099d7034d6a7cf8d1b71f..866847024fd2bff170f589033e241ce189cfd0bc 100755 (executable)
@@ -79,11 +79,11 @@ my %options = (debug              => 0,
               host               => undef,
               identity           => undef,
               username           => undef,
-              'sendmail-options' => '',
+              'sendmail_options' => [''],
              );
 
 GetOptions(\%options,'identity|i=s','username|l=s','daemon|d', 'syslog|s',
-          'sendmail-options|o=s',
+          'sendmail_options|sendmail-options|o=s@',
           'help|h|?','man|m');
 
 pod2usage() if $options{help};
@@ -124,7 +124,9 @@ my @ssh_arguments = ($hostname);
 
 push @ssh_arguments, '-i', $options{identity} if defined $options{identity};
 push @ssh_arguments, '-l', $options{username} if defined $options{username};
-push @ssh_arguments, q(cat - | /usr/lib/sendmail ).$options{'sendmail-options'}.' '.join(' ',@recipients);
+push @ssh_arguments, q(cat - | /usr/lib/sendmail ).
+    join(' ',ref($options{sendmail_options})?@{$options{sendmail_options}}:($options{sendmail_options}//'')).
+    ' '.join(' ',@recipients);
 qx(ping -q -c 3 $hostname 2>/dev/null);
 if ($?) {
      print STDERR "${0}: Failed: unable to ping $hostname\n";