All pastes #291199 Raw Edit

Unnamed

public text v1 · immutable
#291199 ·published 2006-12-24 21:51 UTC
rendered paste body
#!/bin/sh
## 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="/home/nullbzfl/bzfs/confs/5155/cfg"
fi

until [ $b -lt 0 ]; do
   cd $CONFIGPATH
   ls -1 > /home/nullbzfl/tmp/confnos
   
   LIMIT=$(awk 'END { print NR }' /home/nullbzfl/tmp/confnos1)

   for (( a=1; a <= LIMIT ; a++ ))
   do
      COM="NR=="$a
      FILE=$(awk $COM /home/nullbzfl/tmp/confnos1)
      FILE="$CONFIGPATH/$FILE"
      LOGS="/home/nullbzfl/confs/5155/logs/`date +%F`.bzfs.log"
      touch $LOGS
      /home/nullbzfl/bzfs/bzfs/bin/bzfs -conf $FILE >> $LOGS
      sleep 3
   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.