Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

serve restic: trigger systemd notify

Shyim99dd748fec0a
diff --git a/cmd/serve/restic/restic.go b/cmd/serve/restic/restic.go
index db6427dad..5ad1b1675 100644
--- a/cmd/serve/restic/restic.go
+++ b/cmd/serve/restic/restic.go
@@ -13,6 +13,8 @@ import (
"strings"
"time"
+ sysdnotify "github.com/iguanesolutions/go-systemd/v5/notify"
+
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/rclone/rclone/cmd"
@@ -177,7 +179,17 @@ with a path of ` + "`/<username>/`" + `.
return nil
}
fs.Logf(s.f, "Serving restic REST API on %s", s.URLs())
+
+ if err := sysdnotify.Ready(); err != nil {
+ fs.Logf(s.f, "failed to notify ready to systemd: %v", err)
+ }
+
s.Wait()
+
+ if err := sysdnotify.Stopping(); err != nil {
+ fs.Logf(s.f, "failed to notify stopping to systemd: %v", err)
+ }
+
return nil
})
},