]> git.pond.sub.org Git - empserver/blob - scripts/saveass
Initial Release.
[empserver] / scripts / saveass
1 #! /bin/sh
2 #! This is a script that will probably end up saving your ass more times
3 #! then you'll probably want to admit.  I wrote this back when I was co-deity
4 #! of the first empire tourney in December of 1990.  This is a basic script
5 #! run from cron usually 15 miniutes before the update and keeps three copies
6 #! of the binaries and empire data on hand in tared and compressed format.
7 #! If you run faster games increase the frequency of the calls from cron.
8 #! 45 7,15,23 * * * /home/evil/EMP/bin/saveass 
9 #! Above is a sample cron entry that does the backup three times a day.
10 #! This script should run on most all UNIX computers with all you'll have
11 #! to do is change the $BACKUPSDIR variable at the top.
12 #! 
13 #! Dave 'TheEvilOne' Nye, evil@bbn.com
14 #!
15 #! Change these to your site specific directories.
16
17 EMPIREDIR=/home/bughunt/navy
18 BACKUPSDIR=/home/bughunt/navy/backups
19
20 cd $BACKUPSDIR
21 rm -rf data.old.old
22 rm -rf bin.old.old
23 mv data.old data.old.old
24 mv bin.old bin.old.old
25 mv data.new data.old
26 mv bin.new bin.old
27 mkdir data.new
28 mkdir bin.new
29
30 #! Enough set up..let's do some work...
31
32 cd $EMPIREDIR
33 tar -cf data.tar data
34 tar -cf bin.tar bin
35 mv $EMPIREDIR/data.tar $BACKUPSDIR/data.new
36 mv $EMPIREDIR/bin.tar $BACKUPSDIR/bin.new
37
38 #! This will send you mail telling you that the backup went okay.
39
40 /usr/local/bin/gzip $BACKUPSDIR/data.new/data*
41 ls -l $BACKUPSDIR/data.new 
42 /usr/local/bin/gzip $BACKUPSDIR/bin.new/bin*