backup.txt
snippets · 1.6 KB · 2010-03-30
Linux shell backup script by Mike Lynch for backing up your whole MUD.
Download « Back to the snippets list
#!/bin/bash
#LINUX Shell Script by: Mike Lynch
#This is a simple backup script for backing up your entire mud files.
#I recommend placing the file in your /bin directory and doing a hash.
#Or type "./Backup.Script" to execute the script.
#I've tried to comment everything to make it easy to learn and modify
#this script to fit your personal needs. Also I think these same date file
#principles can be used to create dated log files. Plus, the same concept can
#be applied to C based muds using time.h to have backup files generated by
#online command or automated upon startup.
#Feel free to modify, enhance, whatever to this...for further information check
#your favorite linux site for documentation on shell scripting.
#Your output file will be: MonthDayYear.mud.tar.gz
#*****************Modify the following two settings.********************
#It is best to use the full path in the following modifications.
Back_Dir="/User/Backup" #Replace /User/Backup with your desired Backup directory.
Mud_Dir="/User/Mud" #Replace /User/Mud with your main Mud directory.
# *************No More Modifications Required****************
#Get the date for the filename.
shdate=`date +%b%d%y`
#Save our current directory location.
tmp_dir=$PWD
#Change to the Backup file directory.
cd $Back_Dir
#Create a gzip compressed tar file of the Mud Directory.
echo Compressing...
tar -czf ${shdate}.mud.tar.gz $Mud_Dir
#Return to the previous working directory.
cd $tmp_dir
#Print some info on the screen.
echo Your mud has been backed up to file:
echo
echo ${Back_Dir}/${shdate}.mud.tar.gz
echo
echo Backup Complete.
echo Linux Mud Backup Shell Script by: Golorn