#!/usr/bin/perl use Proc::PID::File; die "Already running!" if Proc::PID::File->running; # rest of script follows