#!/bin/sh
#
# start the dhcpd with a new leases file
#
# $Id: sc_start_dhcpd_with_new_leases 5787 2008-09-03 15:33:31Z joergs $
#

. /etc/sysconfig/dhcpd
. /etc/smartclient/leases2ldap

cp -f $LEASES2LDAP_CLEARED_LEASES_FILE $LEASES2LDAP_LEASES_FILE
user_of_dhcpd_leases=root
group_of_dhcpd_leases=root
if [ -n "$DHCPD_RUN_AS" ]; then
    user_of_dhcpd_leases=$DHCPD_RUN_AS
    group_of_dhcpd_leases="$(getent group $(getent passwd $user_of_dhcpd_leases | cut -d: -f4) | cut -d: -f1)"
fi
chown ${user_of_dhcpd_leases}.${group_of_dhcpd_leases} $LEASES2LDAP_LEASES_FILE

/usr/sbin/rcdhcpd start
