Browse Source

touch to create consolelog file

*This will remove any chance of error stating the file does not exist
*Check logs has been added to create log dirs if missing.
pull/305/head
Daniel Gibbs 10 years ago
parent
commit
1b818e0151
  1. 70
      functions/fn_check_logs
  2. 2
      functions/fn_start

70
functions/fn_check_logs

@ -1,42 +1,44 @@
#!/bin/bash
# LGSM fn_install_logs function
# LGSM fn_check_logs function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 260115
# Version: 160215
echo ""
echo "Creating log directorys"
echo "================================="
sleep 1
# Create dir's for the script and console logs
mkdir -v "${rootdir}/log"
mkdir -v "${scriptlogdir}"
touch "${scriptlog}"
mkdir -v "${consolelogdir}"
touch "${consolelog}"
# If a server is source or goldsource create a symbolic link to the game server logs
if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
if [ ! -h "${rootdir}/log/server" ]; then
ln -nfsv "${gamelogdir}" "${rootdir}/log/server"
else
echo "Symbolic link ${gamelogdir} => ${rootdir}/log/server already exists!"
if [ ! -f "${scriptlog}" ]; then
fn_printdots "Checking for log files"
sleep 1
fn_printinfo "Checking for log files: Creating log files"
sleep 1
echo -en "\n"
mkdir -v "${rootdir}/log"
mkdir -v "${scriptlogdir}"
touch "${scriptlog}"
mkdir -v "${consolelogdir}"
touch "${consolelog}"
# If a server is source or goldsource create a symbolic link to the game server logs
if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
if [ ! -h "${rootdir}/log/server" ]; then
ln -nfsv "${gamelogdir}" "${rootdir}/log/server"
else
echo "Symbolic link ${gamelogdir} => ${rootdir}/log/server already exists!"
fi
fi
fi
# If a server is unreal2 or unity3d create a dir
if [ "${engine}" == "unreal2" ]||[ "${engine}" == "unity3d" ]; then
mkdir -pv "${gamelogdir}"
fi
if [ "${gamename}" == "7 Days To Die" ]; then
if [ ! -h "${gamelogdir}/output_log.txt" ]; then
ln -nfsv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt"
# If a server is unreal2 or unity3d create a dir
if [ "${engine}" == "unreal2" ]||[ "${engine}" == "unity3d" ]; then
mkdir -pv "${gamelogdir}"
fi
fi
# If server uses SteamCMD create a symbolic link to the Steam logs
if [ -d "${rootdir}/Steam/logs" ]; then
if [ ! -h "${rootdir}/log/steamcmd" ]; then
ln -nfsv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd"
else
echo "Symbolic link ${rootdir}/Steam/logs => ${rootdir}/log/steamcmd already exists!"
if [ "${gamename}" == "7 Days To Die" ]; then
if [ ! -h "${gamelogdir}/output_log.txt" ]; then
ln -nfsv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt"
fi
fi
fi
sleep 1
# If server uses SteamCMD create a symbolic link to the Steam logs
if [ -d "${rootdir}/Steam/logs" ]; then
if [ ! -h "${rootdir}/log/steamcmd" ]; then
ln -nfsv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd"
else
echo "Symbolic link ${rootdir}/Steam/logs => ${rootdir}/log/steamcmd already exists!"
fi
fi
fi

2
functions/fn_start

@ -71,6 +71,7 @@ fn_start_tmux(){
fn_check_root
fn_check_systemdir
fn_check_ip
fn_check_logs
if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
startfix=1
fn_csgofix
@ -112,6 +113,7 @@ elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd [:digit:])" -eq "18" ]; th
echo "Console logging disabled: Bug in tmux 1.8 breaks logging" >> "${consolelog}"
echo "Currently installed: $(tmux -V)" >> "${consolelog}"
else
touch "${consolelog}"
tmux pipe-pane -o -t ${servicename} "exec cat >> '${consolelog}'"
fi
sleep 1

Loading…
Cancel
Save