Schedules
A schedule starts a script at set times. Use one for a nightly tidy, a Monday report, or a catch-up sweep that doesn’t depend on any event.
Add a schedule
Section titled “Add a schedule”- Open Settings > MaSH > Schedule.
- Choose Add schedule.
- Pick the Script. Add a Description if you like. It shows in the list.
- Choose a Frequency, then fill in the box it shows.
- Set the Timezone.
- Under Files to run on, say which files the script gets (see below).
- Choose Save.
| Frequency | You also set | It runs |
|---|---|---|
| Daily | Hour | once a day on the hour |
| Weekly | Day and Hour | once a week |
| Monthly | Hour | on the 1st of each month |
| Cron | a five-field cron line, such as 0 * * * * | whenever the line says |
| Once | When (a date and time) | one time, then never again |
The hour boxes run on the hour only: there is no 14:30 in Daily. For anything finer, use Cron.
Timezone is an IANA name such as Europe/London. A new schedule starts with your browser’s timezone filled in. The hour, the cron line and the Once time are all read in that zone. Leave it blank and Foldr uses the organisation’s timezone on Foldr Cloud (UTC if none is set), or the server’s own timezone on an appliance. Set it explicitly so a change of server or setting can’t move your schedule.
A Once schedule runs one time. After it has fired it never runs again.
Files to run on
Section titled “Files to run on”A schedule has no event, so it has no file. Files to run on decides what mash.event.files holds:
| Choice | The script gets |
|---|---|
| None: no input files | nothing; mash.event.files is empty |
| Folder listing | the files in a share and path, with an option to include subfolders |
| Glob pattern | files matching a pattern such as *.pdf under a share and path |
| Files matching field criteria | files whose custom fields match the field and value rows you give (each row must match) |
| Explicit list of files | the files you picked |
The script runs once per timetable slot, with the whole list. It does not run once for each file. Loop over the list yourself:
each mash.event.files as doc printline doc.nameend
if mash.event.files_truncated printline "More files matched than were handed over."endprintline "Finished"FinishedA run gets at most 1,000 files. When more matched, mash.event.files_truncated is true and mash.event.total_matched says how many there were. The list is resolved when the run starts, so it reflects the folder at that moment. If the share can’t be read at all (access refused), the run fails and says so. It doesn’t report success for work it never did.
The tutorial’s Reacting to events shows the same page from the first-timer’s side.
Working through a big folder
Section titled “Working through a big folder”A run that handles a thousand files in 60 seconds is rare. Keep the batch small enough to finish. Mark each file as done (a custom field is a good place) and skip the done ones. The next run then picks up where this one stopped. The nightly tidy guide does exactly this.
Overlaps and servers
Section titled “Overlaps and servers”A script can be set to allow only one running copy with a script setting named MASH_SINGLE_INSTANCE. Set it to a true value and a new scheduled start is skipped while the last one is still running or queued. Without it, a slow run can overlap the next.
On a cluster, each schedule fires from one server only. A script that is disabled doesn’t run, and neither does a schedule whose script has been deleted.
Who it runs as
Section titled “Who it runs as”The schedule runs the script as its owner, and the file list is read as that person. See Who a script runs as.