added an env variable
Added an environment variable for the home directory so we don't have to hardcode it or enter it inside a config file
This commit is contained in:
parent
e766f580bb
commit
5afa2c0f9a
4
ssh.go
4
ssh.go
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
)
|
)
|
||||||
@ -91,12 +92,13 @@ func (s SSHConnection) openSession(client SSHClients) SSHSessions {
|
|||||||
func (s SSHConnection) executeSFTP(execute SSHClients) SSHSFTP {
|
func (s SSHConnection) executeSFTP(execute SSHClients) SSHSFTP {
|
||||||
// execute order 66 lol
|
// execute order 66 lol
|
||||||
sftp := SSHSFTP{}
|
sftp := SSHSFTP{}
|
||||||
|
homedir := os.Getenv("HOME")
|
||||||
|
|
||||||
for _, j := range execute {
|
for _, j := range execute {
|
||||||
// TODO: this is just a placeholder, change to the actual tarring executable
|
// TODO: this is just a placeholder, change to the actual tarring executable
|
||||||
getFile(j)
|
getFile(j)
|
||||||
|
|
||||||
err := gzipit("/home/wyatt/"+filename, ".")
|
err := gzipit(homedir+filename, ".")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Errorf("Cannot gzip file(s)", err)
|
fmt.Errorf("Cannot gzip file(s)", err)
|
||||||
|
1
todo.md
1
todo.md
@ -4,3 +4,4 @@
|
|||||||
- Allow fetching of multiple log files (fields under the defined host? Seperate key/field? Dynamic?)
|
- Allow fetching of multiple log files (fields under the defined host? Seperate key/field? Dynamic?)
|
||||||
- Allow different machines to collect different log files
|
- Allow different machines to collect different log files
|
||||||
- Allow to gather directories of log files
|
- Allow to gather directories of log files
|
||||||
|
- Develop a log getting logs for sanity
|
Loading…
Reference in New Issue
Block a user