Skip to content

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 

Repository files navigation

Linux Server Automation Script: Minecraft Backup

This project is a Bash (/bin/sh) script written to automate the backup process for Minecraft (or any web service) files on a Linux server.

Project Purpose

This script performs the critical DevOps practices of automated backup and disk space management. It minimizes the risk of data loss by removing the need for manual intervention.

πŸš€ Key Features

  • Automated Archiving: Compresses a specified source directory (SOURCE_DIR) into .tar.gz format.
  • Datestamping: Names each backup file with a clear timestamp (world-YYYY-MM-DD.tar.gz) for easy identification.
  • Smart Cleanup: Automatically deletes backups older than a specified number of days (e.g., 7 days) to prevent disk space from filling up.
  • Logging: Provides observability by writing all output (success or errors) to a .log file.

πŸ”§ How to Use

  1. Copy the mcbackup.sh script to a directory on your server (e.g., /volume1/scripts/).
  2. Edit the settings section inside the script to match your system:
    SOURCE_DIR="/your/server/files"
    BACKUP_DIR="/your/backup/location"
    DAYS_TO_KEEP=7
  3. Make the script executable:
    chmod +x mcbackup.sh

βš™οΈ Automation (Cronjob)

This script is designed to be run automatically every day using a cronjob (scheduled task).

Add the following line using sudo crontab -e (example runs at 4:05 AM every morning):

5 4 * * * su - [YOUR_USERNAME] -c "/bin/sh /volume1/scripts/mcbackup.sh > /volume1/scripts/mcbackup.log 2>&1"

About

Bash Script for server automation (Minecraft backup)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages