use strict; use warnings; use DateTime qw( ); use IPC::System::Simple qw( system ); my $now = DateTime->now( time_zone => 'locale' ); ( my $target = $now->clone() ) ->set_hour(1) ->set_minute(1) ->set_second(0); $target->add( days => 1 ) if $target < $now; for (;;) { my $dur = $target->epoch() - time(); sleep($dur) if $dur > 0; system( './abc.sh', 'PB' ); system( './abc.sh', 'AB' ); # XXX Assumes the tasks won't take more than a day. $target->add( days => 1 ); }
IPC::System::Simple is used to add error checking to system. This is obviously good, but it's also a problem since it causes an exception that will prevent the task from being executed again. Tweak to your needs.
In reply to Re: Execute on conditional check
by ikegami
in thread Execute on conditional check
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |