mirror of
https://github.com/amineo/t2-stat-parser.git
synced 2026-01-19 17:34:43 +00:00
Refactor FTP command
This commit is contained in:
parent
ddf8c112f5
commit
fbff090ba5
|
|
@ -6,6 +6,7 @@ import (
|
|||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//ShellToUse is...
|
||||
|
|
@ -24,14 +25,15 @@ func Shellout(command string) (error, string, string) {
|
|||
func initFTP() {
|
||||
|
||||
ftpHOST := os.Getenv("FTP_HOST")
|
||||
ftpUSER := os.Getenv("FTP_USER")
|
||||
ftpPW := os.Getenv("FTP_PW")
|
||||
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)
|
||||
|
||||
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 {
|
||||
|
|
@ -43,3 +45,5 @@ func initFTP() {
|
|||
fmt.Println(errout)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue