annotate bin/dbbackup @ 4:aa38447a4b21

First entry of Paradise Server 2.9 patch 10 Beta
author darius
date Sat, 06 Dec 1997 04:37:03 +0000
parents 4d6502ffaa5e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
1 #!/bin/sh
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
2 #
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
3 # backup the database.
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
4 #
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
5 # first argument is the old playerfile, if a second argument exists it is
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
6 # assumed to be NETREKDIR
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
7 #
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
8
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
9 if [ X$1 != X ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
10 NETREKDIR=$1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
11 elif [ X${NETREKDIR} = X ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
12 if [ -f "../etc/conf.netrekdir" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
13 NETREKDIR=`cat "../etc/conf.netrekdir"`
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
14 else
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
15 echo "$0: No NETREKDIR variable found, exiting."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
16 exit 1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
17 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
18 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
19
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
20 ND=$NETREKDIR
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
21 DATE=`date +"%m-%d-%y"`
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
22
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
23 if [ ! -f ${ND}/etc/db.players -o ! ${ND}/etc/db.global ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
24 echo "$0: Database not found, exiting."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
25 echo "$0: (expecting: ${ND}/etc/db.players and ${ND}/db.global)"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
26 exit 1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
27 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
28
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
29 if [ ! -d ${ND}/backups ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
30 echo "$0: ${ND}/backups directory not found, exiting."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
31 exit 1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
32 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
33
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
34 echo "$0: creating ${ND}/backups/db.players-${DATE}"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
35 cp ${ND}/etc/db.players ${ND}/backups/db.players-${DATE}
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
36
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
37 echo "$0: gzipping ${ND}/backups/db.players-${DATE}"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
38 gzip -9 ${ND}/backups/db.players-${DATE}
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
39
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
40 echo "$0: creating ${ND}/backups/db.global-${DATE}"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
41 cp ${ND}/etc/db.global ${ND}/backups/db.global-${DATE}
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
42
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
43 # don't bother zipping the globals, they are piddly
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
44
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
45 echo "$0: Done."