#!/usr/bin/perl # call.pl use warnings; use strict; my $lock_file = 'lock.lck'; print "$0: Calling subtask script...\n"; system("/usr/bin/perl busy.pl &"); my $start = 0; while(1){ # on first loop, sleep two seconds before checking # for the lock file sleep(2) if ! $start; $start++; if (-e $lock_file){ print "$0: Subtask still running...\n"; sleep(1); next; } print "$0: Done!\n"; exit; }