current version 1.0 - 28th March 2024
version | date | comment |
---|---|---|
1.0 | 28/Mar/2024 | Original code |
1.1 | 03/Apr/2024 | function CronNextTime |
license: GNU GPL http://www.gnu.org/licenses/
This file is part of
MOSAICO -- MOdular library for raSter bAsed hydrologIcal appliCatiOn.
Copyright (C) 2011 Giovanni Ravazzani
Language: Fortran 90.
Software Standards: "European Standards for Writing and
Documenting Exchangeable Fortran 90 Code".
Set of fortran routines to manage process scheduling.
The module mimics the way CRONTAB is used on Linux
operating system to schedule processes.
Firstly a string is parsed to set when a process is started.
The function CronParseString
is called to parse the string.
The string is an expression made of five fields which represent
the time to start a process:
|------------- minute (0-59)
| |------------- hour (0-23)
| | |------------ day of the month (1-31)
| | | |------------ month (1-12)
| | | | |------------ day of the week (0-6) (Sunday to Saturday)
| | | | |
| | | | |
| | | | |
* * * * *
Some examples:
0 * * * *
once an hour at the beginning of the hour
0 0 * * *
once a day at midnight
0 0 * * 0
once a week at midnight on Sunday
0 0 1 * *
once a month at midnight of the first day of the month
0 0 1 1 *
once a year at midnight of 1 January
The function CronIsTime
check when the time to execute a process is reached.
References:
https://en.wikipedia.org/wiki/Cron
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=short), | public | :: | daysOfMonth(31) | ||||
integer(kind=short), | public | :: | daysOfWeek(0:6) | ||||
integer(kind=short), | public | :: | hours(0:23) | ||||
integer(kind=short), | public | :: | minutes(0:59) | ||||
integer(kind=short), | public | :: | months(12) | ||||
character(len=300), | public | :: | string |
parse cron string
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | cronString | |||
type(CronTab), | intent(out) | :: | cron |