# Vist https://openmod.github.io/openmod-docs/userdoc/concepts/jobs.html
#
# This file defines jobs to be executed automatically by OpenMod.
#
# Name
# ----
# Job names can be anything and can include spaces, but they must be unique.
# Jobs with dupliate names will be removed.
#
# Scheduling
# ----------
# OpenMod uses crontab syntax for defining when jobs will run.
# Visit http://crontab.guru/ for more information.
# Some special schedules exist:
# - @startup: Executes a job after OpenMod and all plugins have loaded, including reloads.
# - @reboot: Executes a job after OpenMod and all plugins have loaded, excluding reloads.
# - @single_exec: Executes a job a single time and then removes it from this file.
#
# Note: Time is based on local system time
#
# Tasks
# -----
# Tasks define what a job will do.
# OpenMod has 2 built-in tasks:
# - openmod_command: Executes openmod commands.
# Must have args.commands defined!
#
# - system_command: Executes a system command (working directory is set to the OpenMod directory).
# Must have args.commands defined!
#
# Note that plugins can add their own task types.
#
jobs:
  # Upgrade OpenMod every Sunday at 0:00 and then restart.
  - name: OpenMod Auto Update
    #implicit @repeat
    schedule: '0 0 * * 0'
    task: openmod_command
    args:
      commands:
      - openmod upgrade
      # Uncomment the line below to auto restart after upgrade
      # - restart
    enabled: true

  # Restart everyday at 3 AM.
  - name: Auto Restart
    schedule: '@repeat:0 3 * * *'
    task: openmod_command
    args:
      commands:
      - restart
    enabled: false

  # Save every 5 minutes.
  - name: Auto save
    schedule: '*/5 * * * *'
    task: openmod_command
    args:
      commands:
      - save
    enabled: false

  # Purge packages on every startup (note: this is not recommended and just an example)
  - name: Package purge
    schedule: '@startup'
    task: openmod_command
    args:
      commands:
      - openmod purge
    enabled: false

  # Run wipe.sh on every first day of the month
  # It works like terminal (Linux) or cmd (Windows),
  # so you can use scripts like sh or bat or directly run programs
  - name: Wipe
    schedule: 0 0 1 * *
    task: system_command
    args:
      commands:
      - ./wipe.sh
    enabled: false

  # Migrate economy on startup (will only execute a single time)
  - name: Economy Migration
    schedule: '@single_exec'
    task: openmod_command
    args:
      commands:
      - economy migrate
    enabled: false