mirror of
https://github.com/containers/podman.git
synced 2025-10-14 09:45:59 +08:00
Add restart-sec for container service files
Attempts to fix #16419 podman generate systemd --restart-sec pod ^now generates RestartSec= both in pod service file and in container service file. podman generate systemd --restart-sec container ^now generates RestartSec= in container service file. Signed-off-by: Veronika Fuxova <vfuxova@redhat.com>
This commit is contained in:
@ -28,6 +28,7 @@ type containerInfo struct {
|
||||
NotifyAccess string
|
||||
StopTimeout uint
|
||||
RestartPolicy string
|
||||
RestartSec uint
|
||||
StartLimitBurst string
|
||||
PIDFile string
|
||||
ContainerIDFile string
|
||||
@ -87,6 +88,9 @@ Environment={{{{- range $index, $value := .ExtraEnvs -}}}}{{{{if $index}}}} {{{{
|
||||
Environment={{{{ $value }}}}{{{{end}}}}
|
||||
{{{{- end}}}}
|
||||
Restart={{{{.RestartPolicy}}}}
|
||||
{{{{- if .RestartSec}}}}
|
||||
RestartSec={{{{.RestartSec}}}}
|
||||
{{{{- end}}}}
|
||||
{{{{- if .StartLimitBurst}}}}
|
||||
StartLimitBurst={{{{.StartLimitBurst}}}}
|
||||
{{{{- end}}}}
|
||||
@ -282,6 +286,10 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
|
||||
info.RestartPolicy = *options.RestartPolicy
|
||||
}
|
||||
|
||||
if options.RestartSec != nil {
|
||||
info.RestartSec = *options.RestartSec
|
||||
}
|
||||
|
||||
// Make sure the executable is set.
|
||||
if info.Executable == "" {
|
||||
executable, err := os.Executable()
|
||||
|
Reference in New Issue
Block a user