Просмотр исходного кода

fix(ts3): add fix to detect accounting file and delete if possible (#3204)

Christian 5 лет назад
Родитель
Сommit
4e5984ddc0
1 измененных файлов с 17 добавлено и 0 удалено
  1. 17 0
      lgsm/functions/fix_ts3.sh

+ 17 - 0
lgsm/functions/fix_ts3.sh

@@ -14,3 +14,20 @@ if [ ! -f "${serverfiles}/libmariadb.so.2" ]; then
 	cp "${serverfiles}/redist/libmariadb.so.2" "${serverfiles}/libmariadb.so.2"
 	cp "${serverfiles}/redist/libmariadb.so.2" "${serverfiles}/libmariadb.so.2"
 	fn_fix_msg_end
 	fn_fix_msg_end
 fi
 fi
+
+# Fixes: failed to register local accounting service: No such file or directory.
+accountingfile="/dev/shm/7gbhujb54g8z9hu43jre8"
+if [ -f "${accountingfile}" ]; then
+	# Check permissions for the file if the current user owns it, if not exit.
+	if [ "$( stat -c %U ${accountingfile})" == "$(whoami)" ]; then
+		fixname="Delete file ${accountingfile}"
+		fn_fix_msg_start
+		rm -f "${accountingfile}"
+		fn_fix_msg_end
+	# file is not owned by the current user and needs to be deleted manually.
+	else
+		fn_print_error_nl "File ${accountingfile} is not owned by $(whoami) and needs to be deleted manually"
+		fn_script_log_fatal "File ${accountingfile} is not owned by $(whoami) and needs to be deleted manually"
+		core_exit.sh
+	fi
+fi