+if (-e $file_pidfile) {
+ if($mode eq "debug") {
+ print "There is a pid-file already, ".$file_pidfile.", abort execution\n";
+ exit 1;
+ } else {
+ getpidfilecontent();
+ $psstring = `ps fax`;
+ $Jetztwert = time();
+ $Jetztzeit = localtime($Jetztwert);
+ $mailer = '/usr/sbin/sendmail';
+ $Sender = $senderaddress;
+ open(MAIL, "|$mailer -t") || die "Can't open $mailer!\n";
+ print MAIL "To: ".$emailaddress."\n";
+ print MAIL "Subject: Logs NOT CHECKED report $Jetztzeit\n\n\n";
+ print MAIL "There is a pid-file already at ".$file_pidfile.", and the execution of logcheck was aborted!\n\nRemove the pid-file, but make sure logcheck is not running anymore. See output of ps fax below\n\n";
+ print MAIL "Pid of this (the aborted process) is: ".$$."\n";
+ print MAIL "Pid of blocking process is: ".$pidstring."\n\n";
+
+ print MAIL $psstring."\n\n";
+ close(MAIL);
+ exit 1;
+ }
+}
+
+open(ADR, ">$file_pidfile");
+print ADR $$;
+close(ADR);
+