#!/bin/sh
echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
echo " "
sleep 1 > /dev/null 2>&1
echo "- Sending TERM-Signals......to ALL Servers."
echo " "
sleep 1 > /dev/null 2>&1
killall -v hltv > /dev/null 2>&1 
sleep 1 > /dev/null 2>&1
killall -v srcds_run > /dev/null 2>&1
sleep 1 > /dev/null 2>&1
killall -v srcds_linux > /dev/null 2>&1
sleep 1 > /dev/null 2>&1
killall -v hlds_run
sleep 1 > /dev/null 2>&1
killall -v hlds_linux
echo " "
sleep 1 > /dev/null 2>&1
echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
echo " "
sleep 1 > /dev/null 2>&1
echo "     -  Backup Old Server Files:"
echo " "
sleep 1 > /dev/null 2>&1
rm -rf /home/$USER/servers/backup/servers1/hlds  
sleep 1 > /dev/null 2>&1
mv -v /home/$USER/servers/backup/servers0/hlds /home/$USER/servers/backup/servers1/hlds
sleep 1 > /dev/null 2>&1
mv -v /home/$USER/servers/backup/servers/hlds /home/$USER/servers/backup/servers0/hlds
sleep 1 > /dev/null 2>&1
mv -v /home/$USER/servers/hlds/ /home/$USER/servers/backup/servers
echo " "
sleep 1 > /dev/null 2>&1
echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
echo " "
sleep 1 > /dev/null 2>&1
echo "     -  Copy Server Files:..........Please Wait."
echo " "
sleep 1 > /dev/null 2>&1
nice cp -avr /home/default/servers/hlds/ /home/$USER/servers > /dev/null 2>&1
sleep 1 > /dev/null 2>&1
echo "     -  Setup Server Launch Scripts and Settings:"
echo " "
sleep 1 > /dev/null 2>&1
nice cp -avrf /home/$USER/run_cs.sh /home/$USER/servers/hlds
echo " "
sleep 1 > /dev/null 2>&1
nice tar -xzvf def_hlds.tar.gz --overwrite
sleep 1 > /dev/null 2>&1
chmod -R 775 /home/$USER/servers/
echo " "
sleep 1 > /dev/null 2>&1
echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
echo " "
sleep 1 > /dev/null 2>&1
echo "     -  Your Counter-Strike Server is Ready !"
echo " "
sleep 1 > /dev/null 2>&1
echo " "
sleep 1 > /dev/null 2>&1
echo " "
sleep 1 > /dev/null 2>&1
echo " "
sleep 1 > /dev/null 2>&1
echo " "
sleep 1 > /dev/null 2>&1