#!/bin/bash

svendir="/home/svends/sc5"
files=(admins.txt default_map_settings.cfg default_plugins.txt mapcycle.txt mapvote.cfg motd.txt server.cfg);
today=$(date "+%Y-%m-%d")
cp $svendir/svencoop/logs/$today.log $svendir/../scstats/logs/$today.log

for i in ${files[@]}; do
  cp $svendir/svencoop/$i $svendir/svencoop/$i.bak
done

~/steamcmd.sh +login anonymous +force_install_dir $svendir +app_update 276060 validate +quit

for i in ${files[@]}; do
  cp $svendir/svencoop/$i $svendir/svencoop/$i.new
  cp $svendir/svencoop/$i.bak $svendir/svencoop/$i
done

ln -snf $svendir/svencoop_addon/mapcycle.txt $svendir/svencoop/mapcycle.txt
#ln -snf $svendir/svencoop_addon/mapvote.cfg $svendir/svencoop/mapvote.cfg

echo
echo "plz2restart svends k"
echo
