1
0
Эх сурвалжийг харах

Set log folder variable to /var/log/3x-ui (#3599)

* Set log folder variable to /var/log/3x-ui

* Set log folder as x-ui and create the log folder

* Create the log folder in install and update scripts
Nebulosa 4 өдөр өмнө
parent
commit
c061337ce7
4 өөрчлөгдсөн 5 нэмэгдсэн , 2 устгасан
  1. 1 1
      config/config.go
  2. 1 0
      install.sh
  3. 1 0
      update.sh
  4. 2 1
      x-ui.sh

+ 1 - 1
config/config.go

@@ -109,7 +109,7 @@ func GetLogFolder() string {
 	if runtime.GOOS == "windows" {
 		return filepath.Join(".", "log")
 	}
-	return "/var/log"
+	return "/var/log/x-ui"
 }
 
 func copyFile(src, dst string) error {

+ 1 - 0
install.sh

@@ -641,6 +641,7 @@ install_x-ui() {
     # Update x-ui cli and se set permission
     mv -f /usr/bin/x-ui-temp /usr/bin/x-ui
     chmod +x /usr/bin/x-ui
+    mkdir -p /var/log/x-ui
     config_after_install
     
     if [[ $release == "alpine" ]]; then

+ 1 - 0
update.sh

@@ -653,6 +653,7 @@ update_x-ui() {
     
     chmod +x /usr/local/x-ui/x-ui.sh >/dev/null 2>&1
     chmod +x /usr/bin/x-ui >/dev/null 2>&1
+    mkdir -p /var/log/x-ui >/dev/null 2>&1
     
     echo -e "${green}Changing owner...${plain}"
     chown -R root:root /usr/local/x-ui >/dev/null 2>&1

+ 2 - 1
x-ui.sh

@@ -53,7 +53,8 @@ os_version=""
 os_version=$(grep "^VERSION_ID" /etc/os-release | cut -d '=' -f2 | tr -d '"' | tr -d '.')
 
 # Declare Variables
-log_folder="${XUI_LOG_FOLDER:=/var/log}"
+log_folder="${XUI_LOG_FOLDER:=/var/log/x-ui}"
+mkdir -p "${log_folder}"
 iplimit_log_path="${log_folder}/3xipl.log"
 iplimit_banned_log_path="${log_folder}/3xipl-banned.log"