4 15 * * 1 /some/path/is_nth_weekday.pl && /your/path/yourscript #### #!/usr/local/bin/perl -w # is_nth_weekday.pl -- exit successfully if today is the # nth weekday of the month (e.g. 4th Monday) use strict; use Date::Manip; my ($today, $month, $year, $nth_weekday, $today_date, $nth_weekday_date, $which, $day); $which = $ARGV[0] || '4th'; $day = $ARGV[1] || 'monday'; # get today's datetime $today = ParseDate('today'); # get today's month and year to find $nth_weekday ($month, $year) = UnixDate($today, '%B', '%Y'); # get nth Weekday's datetime $nth_weekday = ParseDate("$which $day in $month $year"); # get today's date $today_date = UnixDate($today, '%Y%m%d'); # get nth Weekday's date $nth_weekday_date = UnixDate($nth_weekday, '%Y%m%d'); # is today the nth Weekday? if ($today_date eq $nth_weekday_date) { exit 0; } else { exit 1; }