mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
Merge pull request #394 from tlindsay42/archive-cleanup
Add configurable archive cleanup
This commit is contained in:
commit
5b69c6a63f
14
cron/msm
14
cron/msm
@ -2,7 +2,7 @@
|
|||||||
# Minecraft Server Manager Cron
|
# Minecraft Server Manager Cron
|
||||||
#
|
#
|
||||||
# Backs up worlds, rolls logs, moves worlds in RAM to disk,
|
# Backs up worlds, rolls logs, moves worlds in RAM to disk,
|
||||||
# and starts crashed servers
|
# starts crashed servers, and deletes old archives
|
||||||
#
|
#
|
||||||
# For more information visit the project home page:
|
# For more information visit the project home page:
|
||||||
# https://github.com/msmhq/msm
|
# https://github.com/msmhq/msm
|
||||||
@ -20,3 +20,15 @@
|
|||||||
|
|
||||||
# Start any crashed servers again each hour
|
# Start any crashed servers again each hour
|
||||||
@hourly minecraft /etc/init.d/msm start
|
@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
|
||||||
|
@ -106,7 +106,8 @@ function patch_latest_files() {
|
|||||||
# patch cron file
|
# patch cron file
|
||||||
install_log "Patching MSM cron file"
|
install_log "Patching MSM cron file"
|
||||||
sudo awk '{ if ($0 !~ /^#/) sub(/minecraft/, "'$msm_user'"); print }' \
|
sudo awk '{ if ($0 !~ /^#/) sub(/minecraft/, "'$msm_user'"); print }' \
|
||||||
"$dl_dir/msm.cron.orig" >"$dl_dir/msm.cron"
|
"$dl_dir/msm.cron.orig" | \
|
||||||
|
sed "s#/opt/msm#$msm_dir#g" >"$dl_dir/msm.cron"
|
||||||
|
|
||||||
# patch init file
|
# patch init file
|
||||||
install_log "Patching MSM init file"
|
install_log "Patching MSM init file"
|
||||||
|
Loading…
Reference in New Issue
Block a user