# quit if already running if (-e "/var/run/process_email.pid") { my $pid=9999999999; `cat /var/run/process_email.pid` =~ /(\d+)/ and $pid=$1; exit if (`ps aux|awk '{print \$2}' |grep $pid`); }