summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOndra Machacek <omachace@redhat.com>2021-12-02 13:44:35 +0100
committerOndra Machacek <omachace@redhat.com>2021-12-03 12:11:28 +0100
commitc9ad1da51c6b1aa7eb531a2f9951aa853bdea109 (patch)
tree8e94a4877172747dbfa308d5db2099ddc80dd9ad /cmd
parenta6d1220ac08456dcc075b85b168def3ffeadb58d (diff)
downloadpodman-c9ad1da51c6b1aa7eb531a2f9951aa853bdea109.tar.gz
podman-c9ad1da51c6b1aa7eb531a2f9951aa853bdea109.tar.bz2
podman-c9ad1da51c6b1aa7eb531a2f9951aa853bdea109.zip
Add restart-sec option to systemd generate
Signed-off-by: Ondra Machacek <omachace@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/generate/systemd.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/podman/generate/systemd.go b/cmd/podman/generate/systemd.go
index 173b3656b..a363b7e94 100644
--- a/cmd/podman/generate/systemd.go
+++ b/cmd/podman/generate/systemd.go
@@ -23,6 +23,7 @@ const (
stopTimeoutFlagName = "stop-timeout"
stopTimeoutCompatFlagName = "time"
restartPolicyFlagName = "restart-policy"
+ restartSecFlagName = "restart-sec"
newFlagName = "new"
)
@@ -30,6 +31,7 @@ var (
files bool
format string
systemdRestart string
+ systemdRestartSec uint
startTimeout uint
stopTimeout uint
systemdOptions = entities.GenerateSystemdOptions{}
@@ -88,6 +90,9 @@ func init() {
flags.StringVar(&systemdRestart, restartPolicyFlagName, systemDefine.DefaultRestartPolicy, "Systemd restart-policy")
_ = systemdCmd.RegisterFlagCompletionFunc(restartPolicyFlagName, common.AutocompleteSystemdRestartOptions)
+ flags.UintVarP(&systemdRestartSec, restartSecFlagName, "", 0, "Systemd restart-sec")
+ _ = systemdCmd.RegisterFlagCompletionFunc(restartSecFlagName, completion.AutocompleteNone)
+
formatFlagName := "format"
flags.StringVar(&format, formatFlagName, "", "Print the created units in specified format (json)")
_ = systemdCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(nil))
@@ -111,6 +116,9 @@ func systemd(cmd *cobra.Command, args []string) error {
systemdOptions.New = true
}
+ if cmd.Flags().Changed(restartSecFlagName) {
+ systemdOptions.RestartSec = &systemdRestartSec
+ }
if cmd.Flags().Changed(startTimeoutFlagName) {
systemdOptions.StartTimeout = &startTimeout
}