summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPaul Bütow <pbuetow@mimecast.com>2020-02-16 13:58:26 +0000
committerPaul Bütow <pbuetow@mimecast.com>2020-02-16 13:58:26 +0000
commit6bca637513e065a33cadaccad97ada25eb7a6b00 (patch)
treed08a4c8ee40aba985c82184c20606de7debd42b1 /cmd
parent86ecab818a6089f6da7267463edbc5300ddc155c (diff)
can upload script via drun
Diffstat (limited to 'cmd')
-rw-r--r--cmd/drun/main.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/cmd/drun/main.go b/cmd/drun/main.go
index b1936d4..1b88b1b 100644
--- a/cmd/drun/main.go
+++ b/cmd/drun/main.go
@@ -3,6 +3,7 @@ package main
import (
"context"
"flag"
+ "io/ioutil"
"os"
"github.com/mimecast/dtail/internal/clients"
@@ -67,7 +68,7 @@ func main() {
ServersStr: serversStr,
Discovery: discovery,
UserName: userName,
- What: command,
+ What: readCommand(command),
TrustAllHosts: trustAllHosts,
}
@@ -80,3 +81,16 @@ func main() {
logger.Flush()
os.Exit(status)
}
+
+func readCommand(command string) string {
+ if _, err := os.Stat(command); os.IsNotExist(err) {
+ return command
+ }
+
+ bytes, err := ioutil.ReadFile(command)
+ if err != nil {
+ panic(err)
+ }
+
+ return string(bytes)
+}