Browse Source

added more player only script

master
poikilos 9 years ago
committed by Jacob Gustafson
parent
commit
4a417c06da
  1. 9
      chunkymap-players-cronjob.sh
  2. 3
      install-chunkymap-on-ubuntu.sh
  3. 4
      set-minutely-crontab-job.sh
  4. 16
      set-minutely-players-crontab-job.sh

9
chunkymap-players-cronjob.sh

@ -0,0 +1,9 @@
#!/bin/sh
# NOTE: only works since all scripts in /etc/cron.*/ or crontab run as root
#python /home/owner/minetest/util/chunkymap-regen.py
#-1 FOR LESS THAN ONE MINUTE AGO:
#lol won't work because if the py doesn't run the players won't be updated
#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-players.sh
#fi

3
install-chunkymap-on-ubuntu.sh

@ -23,7 +23,8 @@ cp -f "$CHUNKYMAP_INSTALLER_DIR/chunkymap-regen.py" "$CHUNKYMAP_DEST/"
cp -f "$CHUNKYMAP_INSTALLER_DIR/chunkymap-regen.sh" "$CHUNKYMAP_DEST/" cp -f "$CHUNKYMAP_INSTALLER_DIR/chunkymap-regen.sh" "$CHUNKYMAP_DEST/"
cp -f "$CHUNKYMAP_INSTALLER_DIR/chunkymap-regen-players.sh" "$CHUNKYMAP_DEST/" cp -f "$CHUNKYMAP_INSTALLER_DIR/chunkymap-regen-players.sh" "$CHUNKYMAP_DEST/"
cp -f "$CHUNKYMAP_INSTALLER_DIR/chunkymap-cronjob" "$CHUNKYMAP_DEST/" cp -f "$CHUNKYMAP_INSTALLER_DIR/chunkymap-cronjob" "$CHUNKYMAP_DEST/"
cp -f "$CHUNKYMAP_INSTALLER_DIR/set-minutely-crontab-job.sh" "$CHUNKYMAP_DEST/" cp -f "$CHUNKYMAP_INSTALLER_DIR/chunkymap-players-cronjob" "$CHUNKYMAP_DEST/"
cp -f "$CHUNKYMAP_INSTALLER_DIR/set-minutely-players-crontab-job.sh" "$CHUNKYMAP_DEST/"
cd "$CHUNKYMAP_INSTALLER_DIR" cd "$CHUNKYMAP_INSTALLER_DIR"
python replace-with-current-user.py # the py file only manipulates the minetest/util folder python replace-with-current-user.py # the py file only manipulates the minetest/util folder
# so chmod those files AFTER running the py above: # so chmod those files AFTER running the py above:

4
set-minutely-crontab-job.sh

@ -8,9 +8,9 @@ cd ~
MT_CHUNKYMAP_CRON_TMP=mts_cron.tmp MT_CHUNKYMAP_CRON_TMP=mts_cron.tmp
if [ ! -f "crontab.1st" ]; if [ ! -f "crontab.1st" ];
then then
sudo cp /etc/crontab "crontab.1st" cp /etc/crontab "crontab.1st"
fi fi
crontab -l > "$MT_CHUNKYMAP_CRON_TMP" crontab -l > "$MT_CHUNKYMAP_CRON_TMP"
echo "* * * * * root /home/owner/minetest/util/chunkymap-cronjob" >> "$MT_CHUNKYMAP_CRON_TMP" echo "* * * * * root /home/owner/minetest/util/chunkymap-cronjob" >> "$MT_CHUNKYMAP_CRON_TMP"
sudo crontab "$MT_CHUNKYMAP_CRON_TMP" crontab "$MT_CHUNKYMAP_CRON_TMP"
rm "$MT_CHUNKYMAP_CRON_TMP" rm "$MT_CHUNKYMAP_CRON_TMP"

16
set-minutely-players-crontab-job.sh

@ -0,0 +1,16 @@
#!/bin/sh
#sudo su -
# NOTE: this works only since user is a field on Ubuntu (on some GNU/Linux systems it is not, which is implied by omission at http://www.adminschoice.com/crontab-quick-reference)
# Minute, Hour, Day of Month, Month (1 to 12), Day of Week
# m h dom mon dow user command
cd ~
MT_CHUNKYMAP_CRON_TMP=mts_cron.tmp
if [ ! -f "crontab.1st" ];
then
cp /etc/crontab "crontab.1st"
fi
crontab -l > "$MT_CHUNKYMAP_CRON_TMP"
echo "* * * * * root /home/owner/minetest/util/chunkymap-players-cronjob" >> "$MT_CHUNKYMAP_CRON_TMP"
crontab "$MT_CHUNKYMAP_CRON_TMP"
rm "$MT_CHUNKYMAP_CRON_TMP"
Loading…
Cancel
Save