-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add mail sending capabilities (net/smtp)
- Various changes to the code
- Loading branch information
Showing
6 changed files
with
203 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
rs-backup.json | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.PHONY: all | ||
all: build_linux_amd64 build_darwin_amd64 build_windows_amd64 checksums | ||
|
||
.PHONY: build_linux_amd64 | ||
build_linux_amd64: | ||
GOOS=linux GOARCH=amd64 go build -v -a -gcflags=-trimpath=$$PWD -asmflags=-trimpath=$$PWD -o build/rs-backup-linux-amd64 | ||
|
||
.PHONY: build_linux_i386 | ||
build_linux_i386: | ||
GOOS=linux GOARCH=386 go build -v -a -gcflags=-trimpath=$$PWD -asmflags=-trimpath=$$PWD -o build/rs-backup-linux-i386 | ||
|
||
.PHONY: build_darwin_amd64 | ||
build_darwin_amd64: | ||
GOOS=darwin GOARCH=amd64 go build -v -a -gcflags=-trimpath=$$PWD -asmflags=-trimpath=$$PWD -o build/rs-backup-darwin-amd64 | ||
|
||
.PHONY: build_darwin_i386 | ||
build_darwin_i386: | ||
GOOS=darwin GOARCH=386 go build -v -a -gcflags=-trimpath=$$PWD -asmflags=-trimpath=$$PWD -o build/rs-backup-darwin-i386 | ||
|
||
.PHONY: build_windows_amd64 | ||
build_windows_amd64: | ||
CC=/usr/local/bin/x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -v -a -gcflags=-trimpath=$$PWD -asmflags=-trimpath=$$PWD -o build/rs-backup-windows-amd64.exe | ||
|
||
.PHONY: build_windows_i386 | ||
build_windows_i386: | ||
CC=/usr/local/bin/x86_64-w64-mingw32-gcc GOOS=windows GOARCH=386 go build -v -a -gcflags=-trimpath=$$PWD -asmflags=-trimpath=$$PWD -o build/rs-backup-windows-i386.exe | ||
|
||
.PHONY: checksums | ||
checksums: | ||
shasum -a 256 build/* > build/checksum.txt | ||
|
||
test: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
## rs-backup | ||
|
||
A simple wrapper around rsync written in Go with mail sending possibilities. | ||
A simple wrapper around rsync written in Go with mail sending possibilities. | ||
|
||
The config is minimalistic, set the flags to true which you would like to be included in the command. | ||
|
||
If you set `log` to true, the app will create a temporary file in the system tmp folder and will log the rsync output to that file and will attach this in the email sent at the end. | ||
|
||
If the process is complete, there will be an email sent to the specified to adresses in the config. (accepts multiple adresses i.e. array of strings). | ||
|
||
If there are any questions or bugs, please feel free to open an issue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package helpers | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
) | ||
|
||
func ReadFileContent(fileName string) []byte { | ||
b, err := ioutil.ReadFile(fileName) // just pass the file name | ||
if err != nil { | ||
fmt.Print(err) | ||
} | ||
|
||
return b | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"show_progress": true, | ||
"force_ipv4": true, | ||
"archive": true, | ||
"verbose": true, | ||
"compress": true, | ||
"log": true, | ||
"local_directory_path": "/path/to/the/directory", | ||
"remote_directory_path": "remote_user@remote_host:/remote_path/to/directory", | ||
"remote_shell_command": "ssh -p23", | ||
"mail": { | ||
"from": "[email protected]", | ||
"to": [ | ||
"[email protected]", | ||
"[email protected]" | ||
] | ||
}, | ||
"smtp": { | ||
"host": "mailhost.com", | ||
"user": "[email protected]", | ||
"password": "password", | ||
"port": 25 | ||
} | ||
} |