Criterion4101

Minecraft Backup Script

Feb 24th, 2021 (edited)
607
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.54 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. stamp=$(date "+%F-%T")
  4. mcDir=$(pwd)
  5.  
  6. echo 'Enter the directory to where you want to back the server up (full path required)'
  7. read backupDir
  8.  
  9. echo Beginning backup process
  10. if [ -d ''$backupDir'' ]
  11. then
  12.    echo Compressing the server directory...
  13.    tar -zcvf $backupDir/$stamp.tar.gz $mcDir
  14. else
  15.    echo 'Creating directory '$backupDir' since it does not already exist'
  16.    mkdir -p $backupDir
  17.    echo Now to compress the server directory
  18.    tar -zcvf $backupDir/$stamp.tar.gz $mcDir
  19. fi
  20.  
  21. echo Backup complete. Exiting...
Add Comment
Please, Sign In to add comment