summaryrefslogtreecommitdiffstats
path: root/net/bind/files/named.init
blob: 2ef7797ba0018ac7c4fca9fb765615255b13ebd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh /etc/rc.common
# Copyright (C) 2014 Noah Meyerhans <frodo@morgul.net>
# Licensed under the terms of the GNU General Public License version 2
# or (at your discretion) any later later version

USE_PROCD=1

START=50

config_file=/etc/bind/named.conf
pid_file=/var/run/named/named.pid

logdir=/var/log/named/
cachedir=/var/cache/bind
libdir=/var/lib/bind
config_file=/etc/bind/named.conf

fix_perms() {
    for dir in $libdir $logdir $cachedir; do
	test -e "$dir" || {
            mkdir -p "$dir"
            chgrp bind "$dir"
            chmod g+w "$dir"
	}
    done
}

start_service() {
    user_exists bind 57 || user_add bind 57
    group_exists bind 57 || group_add bind 57
    fix_perms
    procd_open_instance
    procd_set_param command /usr/sbin/named -u bind -f -c $config_file
    procd_set_param respawn
    procd_close_instance
}