Hi,

Isn't it the purpose of the "Unit" section in the service file ?


 cat /usr/lib/systemd/system/kea-dhcp4.service

[Unit]
Description=Kea DHCPv4 Service
Documentation=man:kea-dhcp4(8)
Wants=network-online.target
After=network-online.target
After=time-sync.target

[Service]
User=kea
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_NET_RAW
Environment="KEA_PIDFILE_DIR=/run/kea"
Environment="KEA_LOCKFILE_DIR=/run/kea"
Environment="KEA_LOGGER_DESTINATION=/var/log/kea"
ConfigurationDirectory=kea
RuntimeDirectory=kea
RuntimeDirectoryPreserve=yes
LogsDirectory=kea
LogsDirectoryMode=0750
StateDirectory=kea
ExecStart=/usr/sbin/kea-dhcp4 -c /etc/kea/kea-dhcp4.conf
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target


________________________________
From: Kea-users <kea-users-boun...@lists.isc.org> on behalf of Wagner Vlastimil 
- HZS Ústeckého kraje <vlastimil.wag...@hzscr.cz>
Sent: Wednesday, October 30, 2024 7:50 AM
To: kea-users@lists.isc.org <kea-users@lists.isc.org>
Subject: Re: [Kea-users] [EXTERNAL] Kea fail start after power outage, mysql 
connect problem

I made in systemd service:

ExecStartPre=/bin/bash -c "until host db.example.com; do sleep 1; done"

but i thought that Kea have solution

VW

On Út, 2024-10-29 at 12:23 +0000, Geist, Dan (CCI-Atlanta) via Kea-users wrote:
>
>
>
> Have you considered putting in a “watchdog” timer at the operating system 
> level to restart the OS after a number of minutes (if network link is down) 
> to allow your network gear more time to recover?
>
>
>
>
>
>
>
>
>
> From:Kea-users <kea-users-boun...@lists.isc.org> on behalf of Wagner 
> Vlastimil - HZS Ústeckého kraje <vlastimil.wag...@hzscr.cz>
> Date: Tuesday, October 29, 2024 at 8:00 AM
> To: kea-users@lists.isc.org <kea-users@lists.isc.org>
> Subject: [EXTERNAL] [Kea-users] Kea fail start after power outage, mysql 
> connect problem
>
>
> Hi
>
> I have Kea servers on places where sometimes doesnt work power (longer than 
> UPS)
> I have config, leases and hosts in database MySQL
> When power is back server get up faster than switches and routers so 
> interface is down and Kea doesnt start
>
> říj 29 12:42:15 dhcp-01.hzsulk.cz kea-dhcp4[8647]: ERROR 
> [kea-dhcp4.dhcp4.140105088432256] DHCP4_CONFIG_LOAD_FAIL configuration error 
> using file: /etc/kea/kea-dhcp4.conf, reason: during update from
> config backend database: Unknown server host 'db.example.com' (-2)
> říj 29 12:42:15 dhcp-01.hzsulk.cz kea-dhcp4[8647]: ERROR 
> [kea-dhcp4.dhcp4.140105088432256] DHCP4_INIT_FAIL failed to initialize Kea 
> server: configuration error using file '/etc/kea/kea-dhcp4.conf':
> during update from config backend database: Unknown server host 
> 'db.example.com' >
> říj 29 12:42:15 dhcp-01.hzsulk.cz kea-dhcp4[8647]: ERROR 
> [kea-dhcp4.dhcp4.140105088432256] DHCP4_PARSER_COMMIT_FAIL parser failed to 
> commit changes: during update from config backend database:
> Unknown server host 'db.example.com' (-2)
>
>
> Config is:
>
>
> "Dhcp4": {
>     "server-tag": "DHCP-01",
>     "interfaces-config": {
>         "interfaces": ["ens33"],
>         "service-sockets-max-retries": 100,
>         "service-sockets-retry-wait-time": 5000
>     },
>     "config-control": {
>         "config-databases": [{
>                 "type": "mysql",
>                 "name": "kea",
>                 "user": "kea",
>                 "password": "fhgfethfgthtfeg",
>                 "host": "db.example.com",
>                 "port": 3306,
> #               "retry-on-startup": "true",
>                 "max-reconnect-tries" : 30000,
>                 "reconnect-wait-time": 3000
>             }],
>         "config-fetch-wait-time": 20
>     },
>
> No setting work to try connect again
>
>
> VW

--
ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.

To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.

Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users
-- 
ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.

To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.

Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users

Reply via email to