Mercurial > ~darius > hgwebdir.cgi > paradise_server
comparison bin/dbbackup @ 1:4d6502ffaa5e
Initial revision
author | darius |
---|---|
date | Sat, 06 Dec 1997 04:36:59 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:52b8d91ecc32 | 1:4d6502ffaa5e |
---|---|
1 #!/bin/sh | |
2 # | |
3 # backup the database. | |
4 # | |
5 # first argument is the old playerfile, if a second argument exists it is | |
6 # assumed to be NETREKDIR | |
7 # | |
8 | |
9 if [ X$1 != X ]; then | |
10 NETREKDIR=$1 | |
11 elif [ X${NETREKDIR} = X ]; then | |
12 if [ -f "../etc/conf.netrekdir" ]; then | |
13 NETREKDIR=`cat "../etc/conf.netrekdir"` | |
14 else | |
15 echo "$0: No NETREKDIR variable found, exiting." | |
16 exit 1 | |
17 fi | |
18 fi | |
19 | |
20 ND=$NETREKDIR | |
21 DATE=`date +"%m-%d-%y"` | |
22 | |
23 if [ ! -f ${ND}/etc/db.players -o ! ${ND}/etc/db.global ]; then | |
24 echo "$0: Database not found, exiting." | |
25 echo "$0: (expecting: ${ND}/etc/db.players and ${ND}/db.global)" | |
26 exit 1 | |
27 fi | |
28 | |
29 if [ ! -d ${ND}/backups ]; then | |
30 echo "$0: ${ND}/backups directory not found, exiting." | |
31 exit 1 | |
32 fi | |
33 | |
34 echo "$0: creating ${ND}/backups/db.players-${DATE}" | |
35 cp ${ND}/etc/db.players ${ND}/backups/db.players-${DATE} | |
36 | |
37 echo "$0: gzipping ${ND}/backups/db.players-${DATE}" | |
38 gzip -9 ${ND}/backups/db.players-${DATE} | |
39 | |
40 echo "$0: creating ${ND}/backups/db.global-${DATE}" | |
41 cp ${ND}/etc/db.global ${ND}/backups/db.global-${DATE} | |
42 | |
43 # don't bother zipping the globals, they are piddly | |
44 | |
45 echo "$0: Done." |