Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/pleaserun/platform/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ class InvalidTemplate < ::StandardError; end
validate { |v| v == "ulimited" || v.to_i > 0 }
end


attribute :prestart, "A command to execute before starting and restarting. A failure of this command will cause the start/restart to abort. This is useful for health checks, config tests, or similar operations."

attribute :stop, "A command to execute to stop the service. A failure of this command will cause the stop to abort. Useful when killing process is not enough."

def initialize(target_version)
configurable_setup
self.target_version = target_version
Expand Down
5 changes: 4 additions & 1 deletion templates/systemd/default/program.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{#description}}
Description={{{ description }}}
{{/description}}

[Service]
Type=simple
User={{{ user }}}
Expand All @@ -11,6 +11,9 @@ ExecStart={{{program}}} {{{shell_args}}}
{{#prestart}}
ExecStartPre=/lib/systemd/system/{{{name}}}-prestart.sh
{{/prestart}}
{{#stop}}
ExecStop={{{stop}}}
{{/stop}}
Restart=always

[Install]
Expand Down