~collinp/paradise-netrek/3.1p0

« back to all changes in this revision

Viewing changes to bin/dbbackup.in

  • Committer: Collin Pruitt
  • Date: 2009-05-22 04:40:09 UTC
  • Revision ID: collinp111@gmail.com-20090522044009-gw30zywb9oaae4nr
Initial upload - just the source release of 3.1p0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
NETREKDIR=@NETREKDIR@
 
10
 
 
11
if [ X$1 != X ]; then
 
12
        NETREKDIR=$1
 
13
fi
 
14
 
 
15
export NETREKDIR
 
16
 
 
17
DATE=`date +"%m-%d-%y"`
 
18
 
 
19
if [ ! -f ${NETREKDIR}/etc/db.players -o ! ${NETREKDIR}/etc/db.global ]; then
 
20
        echo "$0: Database not found, exiting."
 
21
        echo "$0: (expecting: ${NETREKDIR}/etc/db.players and ${NETREKDIR}/db.global)"
 
22
        exit 1
 
23
fi
 
24
 
 
25
if [ ! -d ${NETREKDIR}/backups ]; then
 
26
        echo "$0: ${NETREKDIR}/backups directory not found, exiting."
 
27
        exit 1
 
28
fi
 
29
 
 
30
echo "$0: creating ${NETREKDIR}/backups/db.players-${DATE}"
 
31
cp ${NETREKDIR}/etc/db.players ${NETREKDIR}/backups/db.players-${DATE}
 
32
 
 
33
echo "$0: gzipping ${NETREKDIR}/backups/db.players-${DATE}"
 
34
gzip -9 ${NETREKDIR}/backups/db.players-${DATE}
 
35
 
 
36
echo "$0: creating ${NETREKDIR}/backups/db.global-${DATE}"
 
37
cp ${NETREKDIR}/etc/db.global ${NETREKDIR}/backups/db.global-${DATE}
 
38
 
 
39
# don't bother zipping the globals, they are piddly
 
40
 
 
41
echo "$0: Done."