summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2002-04-17 05:22:04 +0000
committerivan <ivan>2002-04-17 05:22:04 +0000
commit92a72252a2340b013462d057a178f1681401b31c (patch)
tree60a008923bd4735eef28f9d75048ffc89d249f6b
parent5d1b7f1ec392d0c4a3c48c8fcd046f72c5d9b9b5 (diff)
pid file foo
-rwxr-xr-xfs_passwd/fs_passwdd13
1 files changed, 12 insertions, 1 deletions
diff --git a/fs_passwd/fs_passwdd b/fs_passwd/fs_passwdd
index be7539984..3a2bd1d27 100755
--- a/fs_passwd/fs_passwdd
+++ b/fs_passwd/fs_passwdd
@@ -9,7 +9,8 @@
use strict;
use Socket;
-my($fs_passwdd_socket)="/usr/local/freeside/fs_passwdd_socket";
+my $fs_passwdd_socket = "/usr/local/freeside/fs_passwdd_socket";
+my $pid_file = "$fs_passwdd_socket.pid"
$ENV{'PATH'} ='/usr/local/bin:/usr/bin:/usr/ucb:/bin';
$ENV{'SHELL'} = '/bin/sh';
@@ -28,6 +29,16 @@ unlink($fs_passwdd_socket);
bind(Server, $uaddr) or die "bind: $!";
listen(Server,SOMAXCONN) or die "listen: $!";
+if ( -e $pid_file ) {
+ open(PIDFILE,"<$pid_file");
+ chomp( my $old_pid = <$pid_file> );
+ close PIDFILE;
+ kill 'TERM', $pid_file;
+}
+open(PIDFILE,">$pid_file");
+print PIDFILE "$$\n";
+close PIDFILE;
+
my($paddr);
for ( ; $paddr = accept(Client,Server); close Client) {
my($me,$old_password,$new_password,$new_gecos,$new_shell);