core: add RestartSteps= and RestartSecMax= for exponentially increasing

interval between restarts

RestartSteps= accepts a positive integer as the number of steps
to take to increase the interval between auto-restarts from
RestartSec= to RestartSecMax=, or 0 to disable it.

Closes #6129
This commit is contained in:
Mike Yuan
2023-03-27 19:31:12 +08:00
parent f447b74185
commit be1adc27fc
7 changed files with 99 additions and 4 deletions
+4
View File
@@ -116,6 +116,8 @@ struct Service {
char *pid_file;
usec_t restart_usec;
unsigned restart_steps;
usec_t restart_usec_max;
usec_t timeout_start_usec;
usec_t timeout_stop_usec;
usec_t timeout_abort_usec;
@@ -245,6 +247,8 @@ extern const UnitVTable service_vtable;
int service_set_socket_fd(Service *s, int fd, struct Socket *socket, struct SocketPeer *peer, bool selinux_context_net);
void service_close_socket_fd(Service *s);
usec_t service_restart_usec(Service *s);
const char* service_restart_to_string(ServiceRestart i) _const_;
ServiceRestart service_restart_from_string(const char *s) _pure_;