mirror of
https://github.com/amineo/t2-stat-parser.git
synced 2026-01-20 01:34:47 +00:00
Refactor FTP command
This commit is contained in:
parent
ddf8c112f5
commit
fbff090ba5
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
//ShellToUse is...
|
//ShellToUse is...
|
||||||
|
|
@ -24,14 +25,15 @@ func Shellout(command string) (error, string, string) {
|
||||||
func initFTP() {
|
func initFTP() {
|
||||||
|
|
||||||
ftpHOST := os.Getenv("FTP_HOST")
|
ftpHOST := os.Getenv("FTP_HOST")
|
||||||
ftpUSER := os.Getenv("FTP_USER")
|
|
||||||
ftpPW := os.Getenv("FTP_PW")
|
|
||||||
ftpPath := os.Getenv("FTP_PATH")
|
ftpPath := os.Getenv("FTP_PATH")
|
||||||
|
ftpUSER := os.Getenv("FTP_USER")
|
||||||
|
ftpPW := strings.Replace(os.Getenv("FTP_PW"), `\\`, `\`, -1)
|
||||||
|
|
||||||
fmt.Println("Downloading stat files from", ftpHOST + ftpPath)
|
fmt.Println("Downloading stat files from", ftpHOST + ftpPath)
|
||||||
|
|
||||||
err, out, errout := Shellout("wget --recursive -nH --cut-dirs=4 --user=" + ftpUSER + " --no-parent --password=" + ftpPW + " -P /app/serverStats/stats/ ftp://" + ftpHOST + ftpPath)
|
cmd := "wget --recursive --no-passive-ftp -nH --cut-dirs=4 --ftp-user=" + ftpUSER + " --no-parent --ftp-password="+ ftpPW +" -P /app/serverStats/stats/ ftp://" + ftpHOST + ftpPath
|
||||||
|
|
||||||
|
err, out, errout := Shellout(cmd)
|
||||||
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -43,3 +45,5 @@ func initFTP() {
|
||||||
fmt.Println(errout)
|
fmt.Println(errout)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue