serve restic: trigger systemd notify
Allow to use Type=notify together with serving restic api
This commit is contained in:
parent
bdfe213c47
commit
99dd748fec
1 changed files with 12 additions and 0 deletions
|
@ -13,6 +13,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
sysdnotify "github.com/iguanesolutions/go-systemd/v5/notify"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/go-chi/chi/v5/middleware"
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
"github.com/rclone/rclone/cmd"
|
"github.com/rclone/rclone/cmd"
|
||||||
|
@ -177,7 +179,17 @@ with a path of ` + "`/<username>/`" + `.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
fs.Logf(s.f, "Serving restic REST API on %s", s.URLs())
|
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()
|
s.Wait()
|
||||||
|
|
||||||
|
if err := sysdnotify.Stopping(); err != nil {
|
||||||
|
fs.Logf(s.f, "failed to notify stopping to systemd: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue