Skip to content

Commit 2597405

Browse files
committed
Set env RESTICPROFILE_ON_SCHEDULE=1 when scheduled
(Schedulers with template support only)
1 parent dba9d09 commit 2597405

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

contrib/posix/templates/systemd.unit.in

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ Description={{ .JobDescription }}
1313
Type=notify
1414
WorkingDirectory={{ .WorkingDirectory }}
1515
ExecStart={{ .CommandLine }}
16-
{{ if .Nice }}Nice={{ .Nice }}{{ end }}
16+
{{ if .Nice -}}
17+
Nice={{ .Nice }}
18+
{{ end -}}
19+
Environment="RESTICPROFILE_ON_SCHEDULE=1"
1720
{{ range .Environment -}}
1821
Environment="{{ . }}"
1922
{{ end -}}

systemd/generate.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//+build !darwin,!windows
1+
//go:build !darwin && !windows
2+
// +build !darwin,!windows
23

34
package systemd
45

@@ -29,6 +30,7 @@ Type=notify
2930
WorkingDirectory={{ .WorkingDirectory }}
3031
ExecStart={{ .CommandLine }}
3132
{{ if .Nice }}Nice={{ .Nice }}{{ end }}
33+
Environment="RESTICPROFILE_ON_SCHEDULE=1"
3234
{{ range .Environment -}}
3335
Environment="{{ . }}"
3436
{{ end -}}

systemd/generate_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//+build !darwin,!windows
1+
//go:build !darwin && !windows
2+
// +build !darwin,!windows
23

34
package systemd
45

@@ -51,6 +52,7 @@ Type=notify
5152
WorkingDirectory=workdir
5253
ExecStart=commandLine
5354
Nice=5
55+
Environment="RESTICPROFILE_ON_SCHEDULE=1"
5456
Environment="HOME=%s"
5557
`
5658
const expectedTimer = `[Unit]

0 commit comments

Comments
 (0)