Created
August 11, 2023 02:00
-
-
Save FCO/d2d2383cc1f2f70756e25d9ceb944fe1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use App::RakuCron::Configuration; | |
sub print-example(Str $msg, +@params, :$time, :$delta-secs, :$something-else) { | |
say "$msg (@params[]) ({ $something-else // "" }): ", $time, " -> { $delta-secs // "None" }" | |
} | |
config { | |
# every Mon/Web/Fri at 10:00:00 | |
.run-at: :10hours, :wday<Mon Wed Fri>, { shell "ls -la" } | |
# every work day at every hour | |
.run-at: :wday(2..6), :hours(*), { say "running!" } | |
# every even day at 00:00 and 00:30 | |
.run-at: :day(* %% 2), :0hours, :minutes[0, 30], { say "running!" } | |
# half in half hour in January | |
.run-at: :month<Jan>, :minutes[0, 30], { say "running!" } | |
# run every minute | |
.run-at: :sec(* %% 5), :capture(\("every 5 secs", :something-else(42))), &print-example; | |
# Every other second | |
.run-at: :2delta-secs, :capture("every other second", "bla", "ble"), &print-example; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment