in reply to Concurrent process

zentara, not sure if your code addresses the problem. The OP seems to want to run one process continuously and every 10 minutes pause that process to run another.

I might try something with alarm.

#! /usr/bin/perl -w $SIG{ALRM} = \&ten_min_task; alarm(600); while (1) { # run in between task here #sleep 1; print "foo\n"; } sub ten_min_task { alarm(600); # run this code every 10 minutes #print "bar\n"; }

Set the alarm timer back to 600s at the beginning of the ten minute task (as shown) to keep execution every 10 minutes regardless of its execution time. Put it at the end of the function if you want it to execute 10 minutes from its last completion.

Replies are listed 'Best First'.
Re^2: Concurrent process
by MidLifeXis (Monsignor) on Mar 29, 2012 at 17:58 UTC

    Just relying on alarm may not be the best choice, as things like sleep may interfere with it (OS Specific). Additionally, you may only have one alarm set at a time.

    It may, however, for the OP's problem, be a sufficient solution.

    --MidLifeXis