...
- Setup your CHARON virtual machine as a service. To do so, refer to the corresponding documentation or install and use the Charon Linux Toolkit.
. Edit the service configuration file and add the following parameters:
Parameter Type Description Restart
text Configures whether the service shall be restarted when the service process exits, is killed, or a timeout is reached RestartSec
numeric Configures the time to sleep before restarting a service (as configured with Restart=
). Takes a unit-less value in seconds, or a time span value such as "5min 20s". Defaults to 100ms.StartLimitInterval
numeric Configure service start rate limiting. By default, services which are started more than 5 times within 10 seconds are not permitted to start any more times until the 10 second interval ends. With these two options, this rate limiting may be modified. Use StartLimitInterval=
to configure the checking interval (defaults toDefaultStartLimitInterval=
in manager configuration file, set to 0 to disable any kind of rate limiting). UseStartLimitBurst=
to configure how many starts per interval are allowed (defaults toDefaultStartLimitBurst=
in manager configuration file).StartLimitBurst
numeric More parameters can be defined for auto-restart. Please refer to your Linux distribution documentation (see 137077595 further)
Div class pagebreak .
Example: The following service will restart in case of failure (Restart=on-failure
) after 30 seconds (RestartSec=30
) with a limit of 2 (StartLimitBurst=2
) within 10 minutes (StartLimitInterval=600
)# vim /usr/lib/systemd/system/as4100.service
Div class commandline [Unit]
Description=DEMO as4100
After=atd.service postfix.service ncu.service aksusbd.service
Wants=aksusbd.service
[Service]
Type=forking
WorkingDirectory=/charon/log
ExecStart=
/opt/charon/bin/as4100 -d /my_services/as4100-service.cfg
ExecStop=/charon/scripts/mystopscript
/my_services/as4100-service.cfg
Restart=on-failure
RestartSec=30
StartLimitInterval=600
StartLimitBurst=2
[Install]
WantedBy=multi-user.target
.
Reload systemd manager configuration:
# systemctl daemon-reload
...
|
...