Code: Select all
#!/bin/bash
## Script for rotating bzfs server maps
## Put seperate config files for each map into a folder and direct CONFIGPATH to it
## or enter the path on the commandline
b=0
if [ $1 ]; then
CONFIGPATH=$1
else
CONFIGPATH="/your/path/to/configfiles"
fi
until [ $b -lt 0 ]; do
cd $CONFIGPATH
ls -1 > /tmp/confnos
LIMIT=$(awk 'END { print NR }' /tmp/confnos)
for (( a=1; a <= LIMIT ; a++ ))
do
COM="NR=="$a
FILE=$(awk $COM /tmp/confnos)
FILE="$CONFIGPATH/$FILE"
bzfs -conf $FILE
done
done
## Due to my intetionally shoddy until loop this script will never exit.
## You can just update the config files in the path
## and they will be used on the next rotation cycle.
## Don't forget to add -g and -time ???? to the config files.