Sfoglia il codice sorgente

Fixed bug identifying and trying to delete the log directory

Now only identifies files
Daniel Gibbs 11 anni fa
parent
commit
0527cd79e8
1 ha cambiato i file con 12 aggiunte e 12 eliminazioni
  1. 12 12
      functions/fn_logs

+ 12 - 12
functions/fn_logs

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