#!/usr/bin/env perl use strict; use warnings; use Carp; fork_bot({ bot => './cfbot.pm --debug', runtime => 60 }); fork_bot({ bot => './cfbot_tester.pm', runtime => 20 }); sub fork_bot { my ( $arg ) = @_; my $pid = fork(); if ( $pid == 0 ){ exec( $arg->{bot} ) or croak "Cannot start [$arg->{bot}] [$!]"; } else{ sleep $arg->{runtime}; kill 1, $pid or croak "Cannot kill pid [$pid]"; } return; }