فهرست منبع

Merge remote-tracking branch 'refs/remotes/origin/master' into dlmanage

Daniel Gibbs 10 سال پیش
والد
کامیت
e240a15ae3
7فایلهای تغییر یافته به همراه322 افزوده شده و 36 حذف شده
  1. 6 1
      BlackMesa/bmdmserver
  2. 2 2
      BrainBread2/bb2server
  3. 138 0
      CodenameCURE/ccserver
  4. 105 0
      CodenameCURE/cfg/lgsm-default.cfg
  5. 1 1
      functions/command_dev_detect_deps.sh
  6. 6 0
      functions/install_config.sh
  7. 64 32
      functions/logs.sh

+ 6 - 1
BlackMesa/bmdmserver

@@ -31,9 +31,14 @@ clientport="27005"
 ip="0.0.0.0"
 updateonstart="off"
 
+# Optional: Game Server Login Token
+# GSLT can be used for running a public server.
+# More info: http://gameservermanagers.com/gslt
+gslt=""
+
 # https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
 fn_parms(){
-parms="-game bms -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
+parms="-game bms -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +sv_setsteamaccount ${gslt} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
 }
 
 #### Advanced Variables ####

+ 2 - 2
BrainBread2/bb2server

@@ -31,8 +31,8 @@ clientport="27005"
 ip="0.0.0.0"
 updateonstart="off"
 
-# Required: Game Server Login Token
-# GSLT is required for running a public server.
+# Optional: Game Server Login Token
+# GSLT can be used for running a public server.
 # More info: http://gameservermanagers.com/gslt
 gslt=""
 

+ 138 - 0
CodenameCURE/ccserver

@@ -0,0 +1,138 @@
+#!/bin/bash
+# Codename CURE
+# Server Management Script
+# Author: Daniel Gibbs
+# Website: http://gameservermanagers.com
+if [ -f ".dev-debug" ]; then
+	exec 5>dev-debug.log
+	BASH_XTRACEFD="5"
+	set -x
+fi
+
+version="271215"
+
+#### Variables ####
+
+# Notification Email
+# (on|off)
+emailnotification="off"
+email="email@example.com"
+
+# Steam login
+steamuser="anonymous"
+steampass=""
+
+# Start Variables
+defaultmap="cbe_bunker"
+maxplayers="6"
+port="27015"
+sourcetvport="27020"
+clientport="27005"
+ip="0.0.0.0"
+updateonstart="off"
+
+# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
+fn_parms(){
+parms="-game cure -insecure -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
+}
+
+#### Advanced Variables ####
+
+# Github Branch Select
+# Allows for the use of different function files
+# from a different repo and/or branch.
+githubuser="dgibbs64"
+githubrepo="linuxgsm"
+githubbranch="master"
+
+# Steam
+appid="383410"
+
+# Server Details
+servicename="cc-server"
+gamename="Codename CURE"
+engine="source"
+
+# Directories
+rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
+selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+lockselfname=".${servicename}.lock"
+filesdir="${rootdir}/serverfiles"
+systemdir="${filesdir}/cure"
+executabledir="${filesdir}"
+executable="./srcds_run"
+servercfg="${servicename}.cfg"
+servercfgdir="${systemdir}/cfg"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+servercfgdefault="${servercfgdir}/lgsm-default.cfg"
+backupdir="${rootdir}/backups"
+
+# Logging
+logdays="7"
+gamelogdir="${systemdir}/logs"
+scriptlogdir="${rootdir}/log/script"
+consolelogdir="${rootdir}/log/console"
+
+scriptlog="${scriptlogdir}/${servicename}-script.log"
+consolelog="${consolelogdir}/${servicename}-console.log"
+emaillog="${scriptlogdir}/${servicename}-email.log"
+
+scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
+consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
+
+##### Script #####
+# Do not edit
+
+fn_getgithubfile(){
+filename=$1
+exec=$2
+fileurl=${3:-$filename}
+filepath="${rootdir}/${filename}"
+filedir=$(dirname "${filepath}")
+# If the function file is missing, then download
+if [ ! -f "${filepath}" ]; then
+	if [ ! -d "${filedir}" ]; then
+		mkdir "${filedir}"
+	fi
+	githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}"
+	echo -e "    fetching ${filename}...\c"
+	if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then
+		:
+	else	
+		echo -e "\e[0;31mFAIL\e[0m\n"
+		echo "Curl is not installed!"
+		echo -e ""
+		exit
+	fi
+	curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
+	if [ $? -ne 0 ]; then
+		echo -e "\e[0;31mFAIL\e[0m\n"
+		echo "${curl}"
+		echo -e "${githuburl}\n"
+		exit
+	else
+		echo -e "\e[0;32mOK\e[0m"
+	fi	
+	if [ "${exec}" ]; then
+		chmod +x "${filepath}"
+	fi
+fi
+if [ "${exec}" ]; then
+	source "${filepath}"
+fi
+}
+
+fn_runfunction(){
+	fn_getgithubfile "functions/${functionfile}" 1
+}
+
+core_functions.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_runfunction
+}
+
+core_functions.sh
+
+getopt=$1
+core_getopt.sh

+ 105 - 0
CodenameCURE/cfg/lgsm-default.cfg

@@ -0,0 +1,105 @@
+// ****************************************************************************
+//                                                                            *
+//     CodenameCURE - server.cfg                                              *
+//     Version 100216                                                         *
+//                                                                            *
+// ****************************************************************************
+
+// ............................. Basic Settings ............................. //
+
+// Hostname for server.
+hostname "<hostname>"
+
+// RCON - remote console password.
+rcon_password "<rconpassword>"
+
+// Server password - for private servers.
+sv_password ""
+
+// Contact email for server sysop.
+sv_contact "email@example.com"
+
+// LAN Mode - If set the server will not show on the internet.
+// Default: sv_lan 0
+sv_lan 0
+
+// ............................... Map Cycles ............................... //
+// info: There are several predefined mapcycles available that are listed below.
+// You can also create your own custom mapcycle. 
+
+// "mapcycle.txt" - all maps
+mapcyclefile "mapcycle.txt"
+
+// ........................ Game Specific Commands ........................ //
+// info: any commands that only apply to this game.
+
+// Difficulty
+// 0 - Easy 
+// 1 - Average 
+// 2 - Skilled 
+// 3 - Insane
+sv_difficulty "1"
+
+// Server tags - Tags show up on the in-game server browser. This helps 
+// users filter servers.
+// 		vanilla - he server runs the default settings.
+// 		custom - the server runs custom gameplay settings or mods.
+// example: sv_tags "custom, fastdl"
+sv_tags ""
+
+// ............................. Communication ............................. //
+
+// Enable communication over voice via microphone.
+// Default: sv_voiceenable 1
+sv_voiceenable 1
+
+// Players can hear all other players, no team restrictions.
+// Default: sv_alltalk 0
+sv_alltalk 1
+
+// ............................. Fast Download .............................. //
+// info: Allows custom maps to be downloaded to the client.
+
+// Allows clients to download custom maps and textures etc. from the server at 20 kbps.
+// Default: sv_allowdownload 1
+sv_allowdownload 1
+
+// Allows clients to download custom maps, textures etc. from a web server with no transfer limit.
+// Example:
+// 		server location: maps/custommap.bsp
+// 		web server location: http://example.com/custom/maps/custommap.bsp
+//		sv_downloadurl "http://example.com/custom"
+// Default: sv_downloadurl ""
+sv_downloadurl ""
+
+// ................................ Ban List ............................... //
+
+// personal banlist based on user IDs.
+exec banned_user.cfg
+
+// personal banlist based on user IPs.	
+exec banned_ip.cfg
+
+writeid
+writeip
+
+// ............................. Server Logging ............................. //
+
+//Enables logging to file, console, and udp < on | off >.
+log on
+
+// Log server bans in the server logs.
+// Default: sv_logbans 1
+sv_logbans 1
+
+// Echo log information to the console.
+// Default: sv_logecho 1
+sv_logecho 1
+
+// Log server information in the log file.
+// Default: sv_logfile 1
+sv_logfile 1
+
+// Log server information to only one file.
+// Default: sv_log_onefile 0
+sv_log_onefile 0

+ 1 - 1
functions/command_dev_detect_deps.sh

@@ -37,7 +37,7 @@ fi
 
 if [ "$(command -v eu-readelf)" ]; then
 	readelf=eu-readelf
-elif [ "$(command -v readelf)" ];
+elif [ "$(command -v readelf)" ]; then
 	readelf=readelf
 else
 	echo "readelf/eu-readelf not installed"	

+ 6 - 0
functions/install_config.sh

@@ -180,6 +180,12 @@ elif [ "${gamename}" == "Blade Symphony" ]; then
 	wget -N /dev/null ${githuburl}/BladeSymphony/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
 	sleep 1
 	fn_goldsourceconfig
+elif [ "${gamename}" == "Codename CURE" ]; then
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/CodenameCURE/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
+
 elif [ "${gamename}" == "Counter Strike 1.6" ]; then
 	echo -e "downloading lgsm-default.cfg...\c"
 	wget -N /dev/null ${githuburl}/CounterStrike/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq

+ 64 - 32
functions/logs.sh

@@ -1,63 +1,95 @@
 #!/bin/bash
 # LGSM logs.sh function
 # Author: Daniel Gibbs
+# Contributor: UltimateByte
 # Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="100215"
 
 # Description: Acts as a log rotater, removing old logs.
 
 local modulename="Log Manager"
 
+# Check if logfile variable and file exist, create logfile if it doesn't exist
 if [ -n "${consolelog}" ]; then
 	if [ ! -e "${consolelog}" ]; then
 		touch "${consolelog}"
 	fi
 fi
-# log manager will active if finds logs older than ${logdays}
-if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then
+
+# Log manager will start the cleanup if it finds logs older than "${logdays}"
+if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; then
 	fn_printdots "Starting"
+	# Set addon logs directories
+	sourcemodlogdir="${systemdir}/addons/sourcemod/logs"
+	ulxlogdir="${systemdir}/data/ulx_logs"
+	darkrplogdir="${systemdir}/data/darkrp_logs"
+	legacyserverlogdir="${rootdir}/log/server"
+	# Setting up counting variables
+	scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" ; legacycount="0"
 	sleep 1
 	fn_printok "Starting"
 	fn_scriptlog "Starting"
 	sleep 1
 	echo -en "\n"
-	fn_printinfo "Removing logs older than ${logdays} days"
-	fn_scriptlog "Removing logs older than ${logdays} days"
+	fn_printinfo "Removing logs older than "${logdays}" days"
+	fn_scriptlog "Removing logs older than "${logdays}" days"
 	sleep 1
 	echo -en "\n"
+	# Logging logfiles to be removed according to "${logdays}", counting and removing them
+	# Script logfiles
+	find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+	scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
+	find "${scriptlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
+	# SRCDS and unreal logfiles
 	if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
-		find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}"
-	fi
-	find "${scriptlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}"
-	if [ -n "${consolelog}" ]; then
-		find "${consolelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}"
-	fi
-	if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
-		gamecount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l)
+		find "${gamelogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+		gamecount=$(find "${gamelogdir}"/ -type f -mtime +"${logdays}"|wc -l)
+		find "${gamelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 	fi
-	scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l)
-	echo "${consolelog}"
+	# Console logfiles
 	if [ -n "${consolelog}" ]; then
-		consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l)
-	else
-		consolecount=0
-	fi
-
-	count=$((${scriptcount} + ${consolecount}))
-	if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
-		count=$((${scriptcount} + ${consolecount} + ${gamecount}))
-	else
-		count=$((${scriptcount} + ${consolecount}))
+		find "${consolelogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+		consolecount=$(find "${consolelogdir}"/ -type f -mtime +"${logdays}"|wc -l)
+		find "${consolelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 	fi
-
-
-	if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
-		find "${gamelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \;
+	# Source addons logfiles
+	if [ "${engine}" == "source" ]; then
+		# SourceMod logfiles
+		if [ -d "${sourcemodlogdir}" ]; then
+			find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+			smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
+			find "${sourcemodlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
+		fi
+		# Garry's Mod logfiles
+		if [ "${gamename}" == "Garry's Mod" ]; then
+			# ULX logfiles
+			if [ -d "${ulxlogdir}" ]; then
+				find "${ulxlogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+				ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
+				find "${ulxlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
+			fi
+			# DarkRP logfiles
+			if [ -d "${darkrplogdir}" ]; then
+				find "${darkrplogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+				darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +"${logdays}"|wc -l)
+				find "${darkrplogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
+			fi
+		fi
 	fi
-	find "${scriptlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \;
-	if [ -n "${consolelog}" ]; then
-		find "${consolelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \;
+	# Legacy support
+	if [ -d "${legacyserverlogdir}" ]; then
+		find "${legacyserverlogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+		legacycount=$(find "${legacyserverlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
+		find "${legacyserverlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
+		# Remove folder if empty
+		if [ ! "$(ls -A "${legacyserverlogdir}")" ]; then
+		rm -rf "${legacyserverlogdir}"
+		fi
 	fi
+				
+	# Count total amount of files removed
+	count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount} + ${legacycount}))
+	# Job done
 	fn_printok "Removed ${count} log files"
 	fn_scriptlog "Removed ${count} log files"
 	sleep 1