use IO::Handle;
use IO::Select;
use IO::File;
-use Storable qw(nstore_fd fd_retrieve);
+use Storable 2.09 qw(nstore_fd fd_retrieve);
use Net::SSH qw(sshopen2);
use FS::UID qw(adminsuidsetup forksuidsetup);
use FS::ClientAPI;
use FS::cust_bill;
use FS::cust_pkg;
-$Debug = 2; # >= 2 will log packet contents, including potentially compromising
+$Debug = 1; # >= 2 will log packet contents, including potentially compromising
# information
$shutdown = 0;
my $user = shift or die &usage;
my $machine = shift or die &usage;
my $tag = scalar(@ARGV) ? shift : '';
-my $pid_file = "/var/run/freeside-selfservice-server.$user.pid";
-#my $pid_file = "/var/run/freeside-selfservice-server.$user.pid"; $FS::UID::datasrc not posible, but should include machine name at least, hmm
+
+# $FS::UID::datasrc not posible
+my $pid_file = "/var/run/freeside-selfservice-server.$user.$machine.pid";
my $lock_file = "/usr/local/etc/freeside/selfservice.$machine.writelock";
open(LOCKFILE,">$lock_file") or die "can't open $lock_file: $!";
warn "Storable error receiving packet from client".
" (assuming lost connection): $@\n"
if $Debug;
+ if ( $ssh_pid ) {
+ warn "sending TERM signal to ssh process $ssh_pid\n" if $Debug;
+ kill 'TERM', $ssh_pid;
+ $ssh_pid = 0;
+ }
last;
}
warn "packet received\n".