From b9da5bc6e513f49a54eee6575218f5c579644b07 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Sat, 20 Feb 2016 21:29:21 -0500 Subject: [PATCH] reduce minutely runs by checking for active players first --- chunkymap-cronjob | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chunkymap-cronjob b/chunkymap-cronjob index 12d62ec..1be6e4b 100644 --- a/chunkymap-cronjob +++ b/chunkymap-cronjob @@ -1,4 +1,8 @@ #!/bin/sh # NOTE: only works since all scripts in /etc/cron.*/ or crontab run as root #python /home/owner/minetest/util/chunkymap-regen.py -flock -n /var/run/chunkymap-regen.lockfile -c /home/owner/minetest/util/chunkymap-regen.sh \ No newline at end of file +#-1 FOR LESS THAN ONE MINUTE AGO: +MT_PLAYERS_ACTIVE_COUNT=$(find /var/www/html/minetest/chunkymapdata/players -type f -mmin -1 | wc -l) +if[ $MT_PLAYERS_ACTIVE_COUNT -gt 0 ]; then + flock -n /var/run/chunkymap-regen.lockfile -c /home/owner/minetest/util/chunkymap-regen.sh +fi \ No newline at end of file