# 
# Minecraft Server Manager Cron
#
# Backs up worlds, rolls logs, moves worlds in RAM to disk,
# starts crashed servers, and deletes old archives
#
# For more information visit the project home page:
# https://github.com/msmhq/msm
#


# Backs up all worlds for all servers at 2 minutes past 5 in the morning
02    05  *   *   *   minecraft   /etc/init.d/msm all worlds backup

# Rolls the logs for all servers at 55 minutes past 4 in the morning
55    04  *   *   *   minecraft   /etc/init.d/msm all logroll

# Moves all "in RAM" worlds to disk every half hour for all servers
*/30  *   *   *   *   minecraft   /etc/init.d/msm all worlds todisk

# Start any crashed servers again each hour
@hourly               minecraft   /etc/init.d/msm start

# Deletes all server log files older than the number of days specified in the mtime parameter value
10    05  *   *   *   minecraft   find /opt/msm/servers/*/logs -maxdepth 1 -mtime +30 -type f -name "*.log.gz" | xargs rm --force

# Deletes all server backup files older than the number of days specified in the mtime parameter value
12    05  *   *   *   minecraft   find /opt/msm/archives/backups -maxdepth 2 -mtime +30 -type f -name "*.zip" | xargs rm --force

# Deletes all msm log files older than the number of days specified in the mtime parameter value
14    05  *   *   *   minecraft   find /opt/msm/archives/logs -maxdepth 2 -mtime +30 -type f -name "*.log.gz" | xargs rm --force

# Deletes all server world backup files older than the number of days specified in the mtime parameter value
16    05  *   *   *   minecraft   find /opt/msm/archives/worlds -maxdepth 3 -mtime +30 -type f -name "*.zip" | xargs rm --force
