I want to run my minecraft server from /tmp but of course don't want to lose the save if my computer crashes.
Can I use symlinks to point to 2 places from a single folder?
Do you want something like this?
a -> b
a -> c
exactly
ty for the great representation, I wasn't sure how to do that.
You can do something like this:
ln -s /path-to/b /path-to/a
ln -s /path-to/c /path-to/a
The result is:
$ ls -F a/
b@ c@
If your concern is to lose the save file, you can always back up it, using the tar utility and cron.
You can manually backup a dir like this
tar -cvpzf /BackupDirectory/backupfilename.tar.gz /ImportantData/directory/path
Where
tar = tape archive
c = Create
v = Verbose mode
p = Preserving Files and Directory Permissions.
z = This will tell tar that compress the files further to reduce the size of tar file.
f = It is allows to tar get file name.
Next step will be to create a script file (backup.sh) to automate the process:
#!/bin/bash
TIME=`date +%b-%d-%y` # This Command will add date in Backup File Name.
FILENAME=backup-$TIME.tar.gz # Here i define Backup file name format.
SRCDIR=/imp-data # Location of Important Data Directory (Source of backup).
DESDIR=/mybackupfolder # Destination of backup file.
tar -cpzf $DESDIR/$FILENAME $SRCDIR
To schedule a task in Linux you can use cron jobs. For setting up cron jobs we use crontab -e command in shell, the first time you use that command cron will ask you the default text editor, just pick the one you prefer.
Open cronab editor utility:
crontab -e
Format of Crontab.
It has 6 Parts:
Minutes Hours Day of Month Month Day of Week Command
0 to 59 0 to 23 1 to 31 1 to 12 0 to 6 Shell Command
Let’s assume I want to run the backup process on every Mon and Sat at 1 pm.
Using the above syntax my crontab file should be something like this
M H DOM M DOW CMND
01 13 * * 1,6 /bin/bash /backup.sh
This script will run at 01:01:00 PM at every Monday and Saturday.
Why do you want it ran in /tmp anyways?
here is my backup.sh for my server. i have it tar everything so if anything goes bad i just untar it and start the server again.
cd /home/$USER
tar -czvf MC-Backup-$(date +%m-%d-%y).tar.gz .Minecraft_Server
this makes a file in my home drive with the title MC-Backup-07-31-15.tar.gz the date will change to that days date.
I then have deja dup backup my home drive to my nas (my tar file is being store in my home drive)
my temporary solutilon was this.
watch cp -R /tmp/MonsterServer/world/ /home/katamari/