projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make the config directory configurable
[freeside.git]
/
FS
/
bin
/
freeside-selfservice-server
diff --git
a/FS/bin/freeside-selfservice-server
b/FS/bin/freeside-selfservice-server
index
c73349a
..
fc04ee9
100644
(file)
--- a/
FS/bin/freeside-selfservice-server
+++ b/
FS/bin/freeside-selfservice-server
@@
-1,7
+1,7
@@
#!/usr/bin/perl -w
use strict;
#!/usr/bin/perl -w
use strict;
-use vars qw( $Debug %kids $kids $max_kids $ssh_pid $keepalives );
+use vars qw( $Debug %kids $kids $max_kids $ssh_pid
%old_ssh_pid
$keepalives );
use subs qw( lock_write unlock_write myshutdown usage );
use Fcntl qw(:flock);
use POSIX qw(:sys_wait_h);
use subs qw( lock_write unlock_write myshutdown usage );
use Fcntl qw(:flock);
use POSIX qw(:sys_wait_h);
@@
-18,6
+18,8
@@
use FS::Conf;
use FS::cust_bill;
use FS::cust_pkg;
use FS::cust_bill;
use FS::cust_pkg;
+$FREESIDE_CONF = "%%%FREESIDE_CONF%%%";
+
$Debug = 1; # 2 will turn on more logging
# 3 will log packet contents, including passwords
$Debug = 1; # 2 will turn on more logging
# 3 will log packet contents, including passwords
@@
-50,11
+52,10
@@
$ENV{HOME} = (getpwuid($>))[7]; #for ssh
adminsuidsetup $user;
#logfile("/usr/local/etc/freeside/selfservice.". $FS::UID::datasrc); #MACHINE
adminsuidsetup $user;
#logfile("/usr/local/etc/freeside/selfservice.". $FS::UID::datasrc); #MACHINE
-logfile("
/usr/local/etc/freeside
/selfservice.$machine.log");
+logfile("
$FREESIDE_SERVER
/selfservice.$machine.log");
daemonize2();
daemonize2();
-
my $conf = new FS::Conf;
my $clientd = "/usr/local/sbin/freeside-selfservice-clientd"; #better name?
my $conf = new FS::Conf;
my $clientd = "/usr/local/sbin/freeside-selfservice-clientd"; #better name?
@@
-102,6
+103,7
@@
while (1) {
if ( $ssh_pid ) {
warn "sending TERM signal to ssh process $ssh_pid\n" if $Debug;
kill 'TERM', $ssh_pid;
if ( $ssh_pid ) {
warn "sending TERM signal to ssh process $ssh_pid\n" if $Debug;
kill 'TERM', $ssh_pid;
+ $old_ssh_pid{$ssh_pid} = 1;
$ssh_pid = 0;
}
last;
$ssh_pid = 0;
}
last;
@@
-133,11
+135,11
@@
while (1) {
} else { #kid time
##get new db handle
} else { #kid time
##get new db handle
-
#
$FS::UID::dbh->{InactiveDestroy} = 1;
-
#
forksuidsetup($user);
+ $FS::UID::dbh->{InactiveDestroy} = 1;
+ forksuidsetup($user);
#get db handle
#get db handle
- adminsuidsetup($user);
+
#
adminsuidsetup($user);
my $type = $packet->{_packet};
warn "calling $type handler\n" if $Debug;
my $type = $packet->{_packet};
warn "calling $type handler\n" if $Debug;
@@
-180,6
+182,10
@@
sub reap_kids {
delete $kids{$kid};
}
}
delete $kids{$kid};
}
}
+
+ foreach my $pid ( keys %old_ssh_pid ) {
+ waitpid($pid, WNOHANG) and delete $old_ssh_pid{$pid};
+ }
#warn "done reaping\n";
}
#warn "done reaping\n";
}