Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RA named: support LSBs /run #350

Closed
b-a-t opened this issue Nov 12, 2013 · 1 comment · Fixed by #561
Closed

RA named: support LSBs /run #350

b-a-t opened this issue Nov 12, 2013 · 1 comment · Fixed by #561
Milestone

Comments

@b-a-t
Copy link

b-a-t commented Nov 12, 2013

Recent Debian introduced support of the LSB /run directory, ewhich is mounted as tmpfs FS. Which implies that on startup it's entirely empty. RA named expects to find named pid file in the {/var}/run/named/named.pid and so fails, as /named/ sub-directory doesn't exist.

Here is a small patch to fix the situation.

--- named.orig  2013-11-02 05:28:37.728810791 +0100
+++ named       2013-11-02 23:03:57.000000000 +0100
@@ -202,6 +202,8 @@

 # Validate most critical parameters
 named_validate_all() {
+    local pid_dir
+
     check_binary $OCF_RESKEY_named
     check_binary $OCF_RESKEY_rndc
     check_binary $OCF_RESKEY_host
@@ -216,6 +218,11 @@
         fi
     fi

+    pid_dir=`dirname "${OCF_RESKEY_named_pidfile}"`
+    if [ -n "$pid_dir" -a ! -d "$pid_dir" ]; then
+        ocf_log info "PID file directory $pid_dir doesn't exist"
+    fi
+
     getent passwd $OCF_RESKEY_named_user >/dev/null 2>&1
     if [ ! $? -eq 0 ]; then
         ocf_log err "User $OCF_RESKEY_named_user doesn't exist";
@@ -334,7 +341,7 @@

 named_start() {
     local root_dir_opt
-    local pid
+    local pid_dir pid group

     root_dir_opt=""
     named_status && return $OCF_SUCCESS
@@ -360,6 +367,15 @@
         return $OCF_ERR_GENERIC
     fi

+    group=`id -gn ${OCF_RESKEY_named_user}`
+    # dirs under [/var]/run can go away on reboots.
+    pid_dir=`dirname "${OCF_RESKEY_named_pidfile}"`
+    if [ ! -d "$pid_dir" ]; then
+        ocf_log info "Creating PID dir: $pid_dir"
+        mkdir -p "$pid_dir"
+        chmod 775 "$pid_dir"
+        chown root:"$group" "$pid_dir" >/dev/null 2>&1 || true
+    fi

     pid=`named_getpid`

With regards,
Timur Bakeyev

@dmuhamedagic
Copy link
Contributor

@b-a-t , the patch looks ok. Though I'm not sure where does the 775 permission come from. Can you open a pull request too? Thanks and sorry for the delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants