2023-09-07 15:20:19 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
"velvettear/gosync/log"
|
|
|
|
"velvettear/gosync/settings"
|
|
|
|
"velvettear/gosync/tools"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
timestamp := time.Now()
|
|
|
|
settings.Initialize()
|
|
|
|
log.Info("starting gosync...")
|
|
|
|
error := tools.TestConnection()
|
|
|
|
if error != nil {
|
2023-09-07 15:51:53 +02:00
|
|
|
if len(settings.Password) == 0 {
|
|
|
|
log.Warning("could not connect to the remote target, make sure passwordless login is configured or supply a password")
|
|
|
|
}
|
|
|
|
log.Fatal("encountered an error connecting to the remote target", error.Error())
|
2023-09-07 15:20:19 +02:00
|
|
|
}
|
|
|
|
tools.Transfer()
|
|
|
|
exit(timestamp, 0)
|
|
|
|
}
|
|
|
|
|
|
|
|
func exit(timestamp time.Time, code int) {
|
|
|
|
log.InfoTimed("gosync finished - exiting...", timestamp.UnixMilli())
|
|
|
|
os.Exit(code)
|
|
|
|
}
|