perl - How do I run a script on the 1st working day of every month? -


I have to run a script on the first working day of each month. Please suggest how I can do this in Perl.

Say that the national holiday in that country should be run on the second working day. I have a binary which gives me the output of last working day if this holiday is for a specific country.

I recommend

Mon-Fri, once every day.

Then your script will have a preliminary test, and if the test fails then it will exit.

The test will be (pseudo-code):

  if (haywkend (today)) {exit; } Elsif (Public_Hold (today)) {exit; } (Day_of_month = 1; day_of_month & lt; today; day_of_month ++) {Next if (is, wait (day_of_month)); If (! Public_HolidayDayday (day_of_month)) {A month was not a valid day before public holiday, so this script should be run successfully, so exit; }} # Run script, because today is not a weekend, not a public holiday, and # not valid legal days before 1st month; For example, a  isWeekend  function may appear in the Perl: 

  subhighend {my ($ epoch_time)  

=) @_; My $ day_of_week = (local time ($ epoch_time)) [6]; Return (1) if ($ day_of_week == 0); # Return of the Sunday (1) if ($ day_of_week ==6); # Returns on Saturday (0); } You must write your own public_holiday function to return to the value of a truth during a public holiday in your particular state / country. / P>


Comments