#!/usr/bin/perl -w use strict; my $stat_file = '/path/to/status.txt'; die "Another instance of this program is running!\n" if (-e $stat_file); open F, '>', $stat_file; close F; # Do all your hard work here # Nice and boring stuff here... yippee! unlink $stat_file;