#!/usr/bin/perl use strict; use Schedule::Cron; use constant { EVERY_MINUTE => '*/1 * * * *' , EVERY_TEN_MINUTE => '0,10,20,30,40,50 * * * *' , EVERY_TEN_MINUTE_OFFSET => '3,23,25,35,45,55 * * * *' }; #Glolbal ##########*******************#################### our $cron = new Schedule::Cron(\&UpdateFile,'processprefix' => 'Index Move'); our $cronId; #MAIN PROGRAM ##########*******************#################### $cronId = $cron->add_entry(EVERY_MINUTE,{'subroutine' => ,\&UpdateFileOne, 'arguments' => ["Passed"]}); $cronId = $cron->add_entry(EVERY_TEN_MINUTE_OFFSET, {'subroutine' => ,\&UpdateFileTen, 'arguments' => ["Passed"]}); sub UpdateFileOne { my $outputfile= '/home/allenrj1/scripts/updatefile.txt'; my $timestamp = localtime(time); my $passed_argument = $_[0]; my $next_time = $cron->get_next_execution_time('*/1 * * * *'); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($next_time); open MYFILE, ">>$outputfile" or die "problem opening $outputfile\n"; print MYFILE "Ran at $timestamp with $passed_argument\n"; printf "Next Time is: %02d:%02d:%02d\n", $hour,$min,$sec; close(MYFILE);