Skip to content

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.

  1. Open Settings > MaSH > Schedule.
  2. Choose Add schedule.
  3. Pick the Script. Add a Description if you like. It shows in the list.
  4. Choose a Frequency, then fill in the box it shows.
  5. Set the Timezone.
  6. Under Files to run on, say which files the script gets (see below).
  7. Choose Save.
FrequencyYou also setIt runs
DailyHouronce a day on the hour
WeeklyDay and Houronce a week
MonthlyHouron the 1st of each month
Crona five-field cron line, such as 0 * * * *whenever the line says
OnceWhen (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.

A schedule has no event, so it has no file. Files to run on decides what mash.event.files holds:

ChoiceThe script gets
None: no input filesnothing; mash.event.files is empty
Folder listingthe files in a share and path, with an option to include subfolders
Glob patternfiles matching a pattern such as *.pdf under a share and path
Files matching field criteriafiles whose custom fields match the field and value rows you give (each row must match)
Explicit list of filesthe 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.name
end
if mash.event.files_truncated
printline "More files matched than were handed over."
end
printline "Finished"
Finished

A 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.

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.

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.

The schedule runs the script as its owner, and the file list is read as that person. See Who a script runs as.