From ecb2c7dd2f917de4b04b5756069c5e629426d9c2 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Sun, 14 Apr 2019 17:46:16 -0600 Subject: [PATCH] there we go --- main.go | 8 ++++++-- test.py | 11 +++++++++++ test.sh | 6 ------ 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 test.py delete mode 100644 test.sh diff --git a/main.go b/main.go index 430cdac..0d00e02 100755 --- a/main.go +++ b/main.go @@ -10,6 +10,7 @@ import ( "flag" "log" "os/exec" + "time" filedriver "github.com/goftp/file-driver" "github.com/goftp/server" @@ -21,7 +22,7 @@ func main() { user = flag.String("user", "admin", "Username for login") pass = flag.String("pass", "123456", "Password for login") port = flag.Int("port", 2121, "Port") - host = flag.String("host", "localhost", "Port") + host = flag.String("host", "", "Host") ) flag.Parse() if *root == "" { @@ -43,7 +44,10 @@ func main() { Password: *pass, }, callback: func() { - log.Printf("callback: %v", exec.Command("sh", "-c", "cd /wiki; git add -A :/; git commit -m \"ftp upload\"").Run()) + go func() { + time.Sleep(time.Second * 5) + log.Printf("callback: %v", exec.Command("sh", "-c", "cd /wiki; git add -A :/; git commit -m \"ftp upload\"").Run()) + }() }, }, } diff --git a/test.py b/test.py new file mode 100644 index 0000000..5eebf97 --- /dev/null +++ b/test.py @@ -0,0 +1,11 @@ +#! /bin/python3 + +import ftplib +import io +import random + +ftp = ftplib.FTP() +ftp.connect("localhost", 38081) +ftp.login("admin", "123456") +s = "".join(random.choices([chr(i) for i in range(ord('a'), ord('z'))], k=5)) +ftp.storlines('STOR test.py', io.BytesIO(s.encode())) diff --git a/test.sh b/test.sh deleted file mode 100644 index a785ff1..0000000 --- a/test.sh +++ /dev/null @@ -1,6 +0,0 @@ -echo " - user admin 123456 - ascii - put Dockerfile - bye -" | ftp -n 127.0.0.1 2121