Skip to content

Commit

Permalink
Set env RESTICPROFILE_ON_SCHEDULE=1 when scheduled
Browse files Browse the repository at this point in the history
(Schedulers with template support only)
  • Loading branch information
jkellerer committed Mar 15, 2022
1 parent 7669389 commit b46f27e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion contrib/posix/templates/systemd.unit.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ Description={{ .JobDescription }}
Type=notify
WorkingDirectory={{ .WorkingDirectory }}
ExecStart={{ .CommandLine }}
{{ if .Nice }}Nice={{ .Nice }}{{ end }}
{{ if .Nice -}}
Nice={{ .Nice }}
{{ end -}}
Environment="RESTICPROFILE_ON_SCHEDULE=1"
{{ range .Environment -}}
Environment="{{ . }}"
{{ end -}}
4 changes: 3 additions & 1 deletion systemd/generate.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build !darwin,!windows
//go:build !darwin && !windows
// +build !darwin,!windows

package systemd

Expand Down Expand Up @@ -29,6 +30,7 @@ Type=notify
WorkingDirectory={{ .WorkingDirectory }}
ExecStart={{ .CommandLine }}
{{ if .Nice }}Nice={{ .Nice }}{{ end }}
Environment="RESTICPROFILE_ON_SCHEDULE=1"
{{ range .Environment -}}
Environment="{{ . }}"
{{ end -}}
Expand Down
4 changes: 3 additions & 1 deletion systemd/generate_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build !darwin,!windows
//go:build !darwin && !windows
// +build !darwin,!windows

package systemd

Expand Down Expand Up @@ -51,6 +52,7 @@ Type=notify
WorkingDirectory=workdir
ExecStart=commandLine
Nice=5
Environment="RESTICPROFILE_ON_SCHEDULE=1"
Environment="HOME=%s"
`
const expectedTimer = `[Unit]
Expand Down

0 comments on commit b46f27e

Please sign in to comment.