You are viewing a potentially older version of this package. View all versions.
JereKuusela-Cron_Job-1.0.0 icon

Cron Job

Allows executing commands automatically on the server.

Date uploaded 3 years ago
Version 1.0.0
Download link JereKuusela-Cron_Job-1.0.0.zip
Downloads 311
Dependency string JereKuusela-Cron_Job-1.0.0

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2202 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured and includes unstripped Unity DLLs.

Preferred version: 5.4.2202
ValheimModding-YamlDotNet-16.3.0 icon
ValheimModding-YamlDotNet

Shared version 16.3.0 of YamlDotNet from Antoine Aubry and contributors, net47 package for use in Valheim mods. Maintained by the ValheimModding team.

Preferred version: 16.3.0

README

Cron Job

Allows executing commands automatically on the server.

Install on the server (modding guide).

Usage

After starting the server, cron.yaml and cron_track.yaml files are created in the config folder.

cron_track.yaml stores the last time a zone was visited. Editing this file is not recommended.

cron.yaml contains the jobs. Jobs are checked every 10 seconds. To understand cron schedules better, check out crontab.guru.

Field jobs includes general jobs. For example:

jobs:
  - command: broadcast center Hello!
    chance: 0.5
    schedule: "0 9 * * *" 

would have a 50% chance of sending a message every day at 9:00 (requires Server Devcommands mod). Times are always in UTC so convert your time zone to that.

Field zone includes zone based jobs. For example:

zone:
  - command: locations_reset Crypt2 zone=$$i,$$j start
    inactive: 60
  - command: vegetation_reset rock4_copper zone=$$i,$$j start
    schedule: "0 9 * * *" 

would reset Burial Grounds if the zone hasn't been visited for 1 hour and reset Copper deposits every day at 9:00 (requires Upgrade World mod).

Following parameters are available:

  • $$i: X index of the targeted zone.
  • $$j: Z index of the targeted zone.
  • $$x: X coordinate of the targeted zone.
  • $$y: Y coordinate of the targeted zone (always 0).
  • $$z: Z coordinate of the targeted zone.

Credits

Thanks for Azumatt for creating the mod icon!

Sources: GitHub

Donations: Buy me a computer

Changelog

  • v1.0
    • Initial release.

CHANGELOG

  • v1.12

    • Adds dependency to YamlDotnet package.
    • Fixed to work with the new Discord Connector mod update.
  • v1.11

    • Adds a new file "cron_last.yaml" to track the last time job were checked.
    • This prevents running all jobs on server restart.
    • Adds a new field useGameTime to run jobs based on the in-game time.
    • Adds a new field commands to run multiple commands.
    • Adds new player related parameters to match Expand World Prefabs mod.
    • Fixes join job triggering on player respawn.
  • v1.10

    • Fixed for the new update.
  • v1.9

    • Adds support for changing the Discord Connector message type.
    • Adds a new setting "logSkipped" to allow disabling logging of skipped jobs.
    • Changes the default Discord Connector mesasge type from "Other" to "cronjob".
  • v1.8

    • Fixed for the new update.