Scheduling File Transfers

Schedule automated file transfers

You probably don’t want to run your file transfers manually every time. MFT uses standard cron expressions to run jobs automatically in the background.

The cron format

MFT uses a 6-field cron expression, which looks like this:

seconds minutes hours day-of-month month day-of-week

For example, 0 0 0 * * ? means “run at 0 seconds, 0 minutes, 0 hours, on any day” — which is just a complicated way of saying “run daily at midnight”.

Common schedules

If you don’t want to write cron expressions from scratch, just copy and paste these:

Every hour

schedule: 0 0 * * * ?

Runs exactly at the top of the hour (1:00, 2:00, 3:00, etc.).

Every 15 minutes

schedule: 0 */15 * * * ?

Runs at 0, 15, 30, and 45 minutes past the hour.

Daily at midnight

schedule: 0 0 0 * * ?

Weekdays at 9 AM

schedule: 0 0 9 * * MON-FRI

Runs Monday through Friday.

Every 2 hours

schedule: 0 0 */2 * * ?

Weekly on Monday

schedule: 0 0 9 * * MON

Daily at 2 AM

schedule: 0 0 2 * * ?

A good time for backups when nobody is using the system.

Understanding the special characters

If you need to build your own schedule, here’s what the symbols mean:

* (Asterisk): Means “any”. If you put it in the month field, the job runs every month.

? (Question mark): Means “I don’t care”. You use this in either the day-of-month or day-of-week fields when you specify one but not the other.

- (Dash): Defines a range.

schedule: 0 0 9 * * MON-FRI  # Monday through Friday

, (Comma): Creates a list of specific values.

schedule: 0 0 9 * * MON,WED,FRI  # Only these three days

/ (Slash): Defines an increment.

schedule: 0 */15 * * * ?  # Every 15 minutes

Putting it together

Here are a few real-world examples of how schedules look inside MFT definitions.

The hourly log sweep

Copying log files to storage every hour:

apiVersion: weik.io/v1alpha1
kind: MFT
metadata:
  name: hourly_logs
spec:
  source:
    name: app_server_smb
    path: logs/
  destination:
    name: weikio_blob
    path: logs/
  command: copy
  filters: "*.log"
  schedule: 0 0 * * * ?

The 2 AM database backup

Grabbing database dumps in the middle of the night:

apiVersion: weik.io/v1alpha1
kind: MFT
metadata:
  name: nightly_backup
spec:
  source:
    name: backup_server_smb
    path: backups/database/
  destination:
    name: backup_s3
    path: database/
  command: copy
  filters: "*.sql.gz"
  schedule: 0 0 2 * * ?

The Monday morning report delivery

Moving generated reports to a partner’s SFTP server at the start of the week:

apiVersion: weik.io/v1alpha1
kind: MFT
metadata:
  name: weekly_reports
spec:
  source:
    name: company_smb
    path: reports/weekly/
  destination:
    name: partner_sftp
    path: incoming/
  command: move
  filters: "report_*.csv"
  schedule: 0 0 9 * * MON

Making sure jobs run on the right agent

Scheduling the job is only half the battle. You also need to make sure it runs on a machine that can actually reach your files.

That’s what the requirements block does. It tells Weik.io to find an agent with specific capabilities:

apiVersion: weik.io/v1alpha1
kind: MFT
metadata:
  name: onpremise_to_cloud
spec:
  source:
    name: company_smb
    path: data/
  destination:
    name: weikio_blob
    path: data/
  command: copy
  schedule: 0 0 0 * * ?
  requirements:
    Location: OnPremise
    Network: internal

If you try to run an SMB transfer on a cloud agent that doesn’t have VPN access to your corporate network, it will fail. By setting Location: OnPremise, the system waits for an on-premise agent to pick up the scheduled task.

Common requirement tags:

  • Location (e.g., OnPremise, Cloud, Edge)
  • Network (e.g., internal, external, vpn)
  • Environment (e.g., production, staging)

Next steps