فهرست منبع

Fixed bug identifying and trying to delete the log directory

Now only identifies files
Daniel Gibbs 11 سال پیش
والد
کامیت
0527cd79e8
1فایلهای تغییر یافته به همراه12 افزوده شده و 12 حذف شده
  1. 12 12
      functions/fn_logs

+ 12 - 12
functions/fn_logs

@@ -2,7 +2,7 @@
 # LGSM fn_logs function
 # LGSM fn_logs function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-# Version: 260415
+# Version: 030715
 
 
 # Description: Acts as a log rotater, removing old logs.
 # Description: Acts as a log rotater, removing old logs.
 
 
@@ -14,7 +14,7 @@ if [ -n "${consolelog}" ]; then
 	fi
 	fi
 fi
 fi
 # log manager will active if finds logs older than ${logdays}
 # log manager will active if finds logs older than ${logdays}
-if [ $(find "${scriptlogdir}"/ -mtime +${logdays}|wc -l) -ne "0" ]; then
+if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then
 	fn_printdots "Starting"
 	fn_printdots "Starting"
 	sleep 1
 	sleep 1
 	fn_printok "Starting"
 	fn_printok "Starting"
@@ -26,19 +26,19 @@ if [ $(find "${scriptlogdir}"/ -mtime +${logdays}|wc -l) -ne "0" ]; then
 	sleep 1
 	sleep 1
 	echo -en "\n"
 	echo -en "\n"
 	if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
 	if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
-		find "${gamelogdir}"/ -mtime +${logdays}|tee >> "${scriptlog}"
+		find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}"
 	fi
 	fi
-	find "${scriptlogdir}"/ -mtime +${logdays}|tee >> "${scriptlog}"
+	find "${scriptlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}"
 	if [ -n "${consolelog}" ]; then
 	if [ -n "${consolelog}" ]; then
-		find "${consolelogdir}"/ -mtime +${logdays}|tee >> "${scriptlog}"
+		find "${consolelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}"
 	fi
 	fi
 	if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
 	if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
-		gamecount=$(find "${scriptlogdir}"/ -mtime +${logdays}|wc -l)
+		gamecount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l)
 	fi
 	fi
-	scriptcount=$(find "${scriptlogdir}"/ -mtime +${logdays}|wc -l)
+	scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l)
 	echo "${consolelog}"
 	echo "${consolelog}"
 	if [ -n "${consolelog}" ]; then
 	if [ -n "${consolelog}" ]; then
-		consolecount=$(find "${consolelogdir}"/ -mtime +${logdays}|wc -l)
+		consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l)
 	else
 	else
 		consolecount=0
 		consolecount=0
 	fi
 	fi
@@ -52,14 +52,14 @@ if [ $(find "${scriptlogdir}"/ -mtime +${logdays}|wc -l) -ne "0" ]; then
 
 
 
 
 	if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
 	if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
-		find "${gamelogdir}"/ -mtime +${logdays} -exec rm {} \;
+		find "${gamelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \;
 	fi
 	fi
-	find "${scriptlogdir}"/ -mtime +${logdays} -exec rm {} \;
+	find "${scriptlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \;
 	if [ -n "${consolelog}" ]; then
 	if [ -n "${consolelog}" ]; then
-		find "${consolelogdir}"/ -mtime +${logdays} -exec rm {} \;
+		find "${consolelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \;
 	fi
 	fi
 	fn_printok "Removed ${count} log files"
 	fn_printok "Removed ${count} log files"
 	fn_scriptlog "Removed ${count} log files"
 	fn_scriptlog "Removed ${count} log files"
 	sleep 1
 	sleep 1
 	echo -en "\n"
 	echo -en "\n"
-fi
+fi