- my $pid = $$;
- my $file = $file{PID};
-
- if ( -f $file) {
- open(PIDFILE,$file) or die "error: cannot open $file.";
- my $thispid = <PIDFILE> || "NULL\n";
- close PIDFILE;
- chop $thispid;
-
- if ($thispid =~ /^\D$/) {
- &staus("warning: pidfile is invalid; wiping out.");
- } else {
- if ( -d "/proc/$thispid/") {
- &ERROR("bot is already running from this directory.");
- &ERROR("if this is incorrect, erase '*.pid'.");
- &ERROR("verify with 'ps -axu | grep $thispid'.");
- exit 1;
- } else {
- &status("warning: stale $file found; wiping.");
- }
- }
+ my $pid = $$;
+ my $file = $file{PID};
+
+ if ( -f $file ) {
+ open( PIDFILE, $file ) or die "error: cannot open $file.";
+ my $thispid = <PIDFILE> || "NULL\n";
+ close PIDFILE;
+ chop $thispid;
+
+ if ( $thispid =~ /^\D$/ ) {
+ &staus("warning: pidfile is invalid; wiping out.");
+ }
+ else {
+ if ( -d "/proc/$thispid/" ) {
+ &ERROR("bot is already running from this directory.");
+ &ERROR("if this is incorrect, erase '*.pid'.");
+ &ERROR("verify with 'ps -axu | grep $thispid'.");
+ exit 1;
+ }
+ else {
+ &status("warning: stale $file found; wiping.");
+ }
+ }