001 #!/usr/bin/perl 023 opendir(ISPELL,"/usr/lib/ispell")|| die "No /usr/lib/ispell dir found\n"; 024 @files=readdir(ISPELL); 025 closedir(ISPELL); 026 $index=0; 027 while (($index <= $#files)&&(!$usefile)) 028 { 029 $file=$files[$index]; 030 if ($file =~ /\.hash$/) 031 { 032 $usefile=$file; 033 } 034 $index++; 035 } 136 if (open(PID,"/tmp/rident.pid")) 137 { 139 $opid=; 140 chomp($opid); 141 close(PID); 142 unless ($opid =~ /^\d+$/) 143 { 145 exit; 146 } 148 open(PS,"/bin/ps -p $opid|"); 149 $killit=0; 150 while () 151 { 152 if (/ridentd.pl/) 153 { 154 $killit=1; 155 } 156 } 157 if ($killit) 158 { 160 kill(9,$opid); 161 sleep(1); 162 } 167 } 176 $pid=fork(); 181 if ($pid) 182 { 183 open(PID,">/tmp/rident.pid"); 184 print PID "$pid\n"; 187 }