<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi!<br><br>I noticed a few mistakes. The unit description in the DHCPv6 service file is wrong and StandardOutput is specified in the DHCPv6 and DDNS service files but they can be deleted, journald already captures stdout and stderr.<br><br>I hope the service files will work for you after you've adapted them to your system.<br><br>All suggestions are welcome!<br><br>Tobias<br><br><div><hr id="stopSpelling">From: lokskada@live.se<br>To: todsimmo@cisco.com<br>CC: kea-users@lists.isc.org<br>Subject: RE: [Kea-users] Auto start<br>Date: Thu, 21 Jul 2016 05:08:40 +0200<br><br>
<style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}
.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}
--></style>
<div dir="ltr">Hi Todd!<br><br>I've tried to do the same thing. I tried to adapt Kea to systemd but I was unable to get satisfying results using keactrl so I opted to skip that step and run the services directly and I wrote a service file for each one. I also changed the logger configuration to output all logging information to /dev/log and let journald handle it, allowing me to use the features of journald. The Kea services expect logger_lockfile to exist even if the logger has been configured to just print to /dev/log, so I added two ExecStartPre commands.<br><br>Kea shouldn't handle the logging, it should let syslogd or journald handle it, they both use the same interface and is compatible with both BSD and Linux. If you have journald (I believe that all distrubutions with systemd do) then I recommend that you take advantage of it by pointing the output in the logger configuration in kea.conf to /dev/log. For anyone who doesn't use journald then I highly recommend that you also configure the logging daemon to put the output of kea into separate log files which is a common practice.<br><br>Here are the results (also sent as attachments):<br><br>----- kea-dhcp4.service -----<br>[Unit]<br>Description=ISC Kea DHCPv4 server<br>Documentation=man:kea-dhcp4(8)<br>Wants=network.target<br><br>[Service]<br>user=kea<br>ProtectSystem=full<br>ProtectHome=true<br>ExecStartPre=/usr/bin/mkdir -p /var/run/kea/<br>ExecStartPre=/usr/bin/touch /var/run/kea/logger_lockfile<br>ExecStart=/usr/bin/kea-dhcp4 -c /etc/kea/kea.conf<br>ExecReload=/usr/bin/kill --signal SIGHUP ${MAINPID}<br>Restart=always<br>RestartSec=5s<br><br>[Install]<br>WantedBy=multi-user.target<br>----- EOF -----<br>----- kea-dhcp6.service -----<br>[Unit]<br>Description=ISC Kea DHCPv4 server<br>Documentation=man:kea-dhcp6(8)<br>Wants=network.target<br><br>[Service]<br>user=kea<br>ProtectSystem=full<br>ProtectHome=true<br>ExecStartPre=/usr/bin/mkdir -p /var/run/kea/<br>ExecStartPre=/usr/bin/touch /var/run/kea/logger_lockfile<br>ExecStart=/usr/bin/kea-dhcp6 -c /etc/kea/kea.conf<br>ExecReload=/usr/bin/kill --signal SIGHUP ${MAINPID}<br>Restart=always<br>RestartSec=5s<br><br>[Install]<br>WantedBy=multi-user.target<br>----- EOF -----<br>----- kea-dhcp-ddns.service -----<br>[Unit]<br>Description=ISC Kea DHCP-DDNS server<br>Documentation=man:kea-dhcp-ddns(8)<br>Wants=network.target<br><br>[Service]<br>user=kea<br>ProtectSystem=full<br>ProtectHome=true<br>ExecStartPre=/usr/bin/mkdir -p /var/run/kea/<br>ExecStartPre=/usr/bin/touch /var/run/kea/logger_lockfile<br>ExecStart=/usr/bin/kea-dhcp-ddns -c /etc/kea/kea.conf<br>ExecReload=/usr/bin/kill --signal SIGHUP ${MAINPID}<br>Restart=always<br>RestartSec=5s<br><br>[Install]<br>WantedBy=multi-user.target<br>----- EOF -----<br><br>Tobias<br><br><br><div><hr id="ecxstopSpelling">From: todsimmo@cisco.com<br>To: klausfiend@gmail.com<br>Date: Thu, 21 Jul 2016 01:26:55 +0000<br>Subject: Re: [Kea-users] Auto start<br>CC: kea-users@lists.isc.org<br><br>
<div>
<div style="font-family:Calibri, sans-serif;">Klaus,</div>
<div style="font-family:Calibri, sans-serif;"><br>
</div>
<div style="font-family:Calibri, sans-serif;">Thanks for the info. I did try the following:</div>
<div style="font-family:Calibri, sans-serif;"><br>
</div>
<div>Added a new user: <span style="color:rgb(51, 51, 51);font-size:13px;line-height:1.42857143;background-color:rgb(245, 245, 245);">adduser kea -s /sbin/nologin</span> </div>
<div>Created the file: /etc/systemd/system/kea.service</div>
<div><br>
</div>
<div>
<pre style="vertical-align:baseline;padding:9.5px !important;border:1px solid rgb(204, 204, 204) !important;font-size:13px !important;line-height:1.42857143 !important;color:rgb(51, 51, 51) !important;word-break:break-all !important;word-wrap:break-word !important;background-color:rgb(245, 245, 245) !important;border-top-left-radius:4px !important;border-top-right-radius:4px !important;border-bottom-right-radius:4px !important;border-bottom-left-radius:4px !important;font-family:Menlo, Monaco, Consolas, 'Courier New', monospace !important;overflow:auto !important;">[Unit]
Description=kea Service
After=network.target
[Service]
Type=simple
User=kea
ExecStart=/usr/local/sbin/keactrl start
Restart=on-abort
[Install]
WantedBy=multi-user.target</pre>
</div>
<div style="font-family:Calibri, sans-serif;">
<div><br>
</div>
<div>Then I type this command: systemctl start kea</div>
<div>Then I check it with this command: systemctl status kea</div>
<div><br>
</div>
<div>
<div>[root@localhost todsimmo]# systemctl status kea</div>
<div>‚óč kea.service - kea Service</div>
<div> Loaded: error (Reason: Invalid argument)</div>
<div> Active: failed (Result: exit-code) since Wed 2016-07-20 14:01:45 CDT; 5min ago</div>
<div> Main PID: 4111 (code=exited, status=1/FAILURE)</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>I’ve also tried calling the kea-dhcp4 command, but it doesn’t work either.</div>
<div><br>
</div>
<div>Any help is appreciated,</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Todd</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
<span id="ecxOLK_SRC_BODY_SECTION" style="font-family:Calibri, sans-serif;">
<div style="font-family:Calibri;font-size:11pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt;">
<span style="font-weight:bold;">From: </span>Klaus Steden <<a href="mailto:klausfiend@gmail.com">klausfiend@gmail.com</a>><br>
<span style="font-weight:bold;">Date: </span>Wednesday, July 20, 2016 at 9:13 PM<br>
<span style="font-weight:bold;">To: </span>Todd Simmons <<a href="mailto:todsimmo@cisco.com">todsimmo@cisco.com</a>><br>
<span style="font-weight:bold;">Cc: </span>"<a href="mailto:kea-users@lists.isc.org">kea-users@lists.isc.org</a>" <<a href="mailto:kea-users@lists.isc.org">kea-users@lists.isc.org</a>><br>
<span style="font-weight:bold;">Subject: </span>Re: [Kea-users] Auto start<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr"><br>
<div>CentOS 7 uses systemd. I'm by no means an expert on it, but you may be able to shoehorn systemd into thinking that it's a managed service (there's apparently legacy support for SVR4-style init scripts) using systemctl. Again, being still new to systemd
myself, I can't really offer much useful advice beyond that, but that's where I'd start looking.</div>
<div><br>
</div>
<div>hth,</div>
<div>Klaus</div>
</div>
<div class="ecxgmail_extra"><br>
<div class="ecxgmail_quote">On Wed, Jul 20, 2016 at 5:25 PM, Todd Simmons (todsimmo)
<span dir="ltr"><<a href="mailto:todsimmo@cisco.com" target="_blank">todsimmo@cisco.com</a>></span> wrote:<br>
<blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word;">
<div style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px;"><span style="font-family:Times;text-align:-webkit-auto;">Kea Users,</span></div>
<div>
<div style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px;"><span style="text-align:-webkit-auto;"><font face="Times"><br>
</font></span></div>
<div>I’m on CentOS 7 running the Kea 1.0.0 server without issues. My only problem is that if my system is shutdown or rebooted I have to manually run “keactrl start” to get the server running again. What options do I have to have the DHCP server startup automatically?
I tried chkconfig, but keactrl or the kea-dhcp4/6 are not listed as services.</div>
<div><br>
</div>
<div>Thanks for the help,</div>
<div style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px;"><span style="font-family:Times;text-align:-webkit-auto;"><br>
</span></div>
<div style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px;"><span style="font-family:Times;text-align:-webkit-auto;"><br>
</span></div>
<div style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px;"><span style="font-family:Times;text-align:-webkit-auto;"><br>
</span></div>
<div style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px;"><span style="font-family:Times;text-align:-webkit-auto;">Todd </span></div>
<div style="color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14px;">
<p style="font-family:Times;text-align:-webkit-auto;"></p>
</div>
</div>
</div>
<br>
_______________________________________________<br>
Kea-users mailing list<br>
<a href="mailto:Kea-users@lists.isc.org">Kea-users@lists.isc.org</a><br>
<a href="https://lists.isc.org/mailman/listinfo/kea-users" rel="noreferrer" target="_blank">https://lists.isc.org/mailman/listinfo/kea-users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</span>
<br>_______________________________________________
Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users</div> </div></div> </div></body>
</html>