#!/usr/bin/env bash

set -eo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/world_server_force_changed.conf"

minutes="${1:-15}"

if ! [[ "$minutes" =~ ^[0-9]+$ ]]; then
    echo "ERROR: minutes must be a non-negative integer" >&2
    exit 1
fi

date -d "+${minutes} minutes" +%s > "$CRON_FORCE_CHANGED_FILE"
