1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#!/bin/sh
#
# Standard MUSH backup script modified by bem@erisian.net to work with MUX
#
PATH=/bin:/usr/bin:/usr/local/bin:.; export PATH
#
. mux.config
#
# You'll want to use gzip if you have it. If you want really good
# compression, try 'gzip --best'. If you don't have gzip, use 'compress'.
ZIP=gzip
#
DBDATE=`date +%m%d-%H%M`
#
# files to tar up
TEXT_FILES="$TEXT/badsite.txt $TEXT/connect.txt $TEXT/create_reg.txt $TEXT/down.txt $TEXT/full.txt $TEXT/guest.txt $TEXT/motd.txt $TEXT/news.txt $TEXT/newuser.txt $TEXT/plushelp.txt $TEXT/quit.txt $TEXT/register.txt $TEXT/wizmotd.txt $TEXT/wiznews.txt $TEXT/staffhelp.txt"
CONFIG_FILES="mux.config $GAMENAME.conf"
GAME_DB=$DATA/$GAMENAME.FLAT
if [ -r $DATA/comsys.db ]; then
COMM_DB=$DATA/comsys.db
fi
if [ -r $DATA/mail.db ]; then
MAIL_DB=$DATA/mail.db
fi
if [ -r $DATA/$NEW_DB ]; then
RECENT_DB=$DATA/$NEW_DB
else
if [ -r $DATA/$INPUT_DB ]; then
echo "No recent checkpoint db. Using older db."
RECENT_DB=$DATA/$INPUT_DB
else
if [ -r $DATA/$SAVE_DB ]; then
echo "No input db. Using backup db."
RECENT_DB=$DATA/$SAVE_DB
else
echo "No dbs. Backup attempt failed."
exit
fi
fi
fi
VERSION_LINE=`head -n 1 $RECENT_DB`
if [ $VERSION_LINE = "+X992001" -o $VERSION_LINE = "+X992002" ]; then
cp $RECENT_DB $GAME_DB
else
if [ $VERSION_LINE = "+X1031937" -o $VERSION_LINE = "+X1031938" ]; then
$BIN/dbconvert -d$DATA/$GDBM_DB -u -i$RECENT_DB -o$GAME_DB
else
echo "Unrecognized header in $RECENT_DB."
exit
fi
fi
tar cf - $GAME_DB $COMM_DB $MAIL_DB $CONFIG_FILES $TEXT_FILES | $ZIP -c > $GAMENAME.$DBDATE.tar.gz
rm $GAME_DB
|