diff --git a/README.md b/README.md index fbfec8e..c95e1de 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,12 @@ A script to automatically handle the backing up of MongoDB databases and optiona [Service] Type=simple + User=username + Group=admin Restart=always - RestartSec=5 - ExecStart=/path/to/binary/file + RestartSec=46400 + WorkingDir=/path/to/project + ExecStart=/path/to/project/binary [Install] WantedBy=multi-user.target diff --git a/main.go b/main.go index f1bd2d2..ea80a3c 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "log" "path/filepath" "time" + "runtime" "github.com/joho/godotenv" "strings" @@ -16,6 +17,7 @@ const dtFormat string = "2006-01-02 15:04:05 Monday" func Handle(err error) { if err != nil { + LogToFile(err.Error()) log.Panic(err.Error()) } }