Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9180655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:06:33+00:00 2026-06-17T18:06:33+00:00

I’ve set up and configured Nagios remote external command daemon on our nagios box,

  • 0

I’ve set up and configured Nagios remote external command daemon on our nagios box, but I’ve found that as soon as it is started it seems to terminate without any error.

The server is ubuntu 12.10 and nrecd was installed from the tar file as a simple process – make a config directory, add a line to /etc/rc.local, copy the bin file into /usr/bin and do the config.

when I run sudo nrecd, the response is Server nrecd started successfully. PID = 10698., however if I then immediately run ps -A | grep 10698 I see nothing. Similarly, a netstat -an shows no service listening on 5665.

in the log file the only entries I see are when I have stopped the server (even those are falsities considering all that actually happens when I sudo nrecd stop is delete the stale pidfile).

in /usr/bin/nrecd, I had a look through the code for the line that prints the “Server successfully started” line and added some other print‘s around the place:

my $mypid = daemonize();
print "Server $basename started successfully. PID = $mypid.\n" if $mypid;
print "line 122";
create_pid_file( $mypid, $pidfile );
print "line 124";
change_privileges( $user, $group );
print "line 126";
lock_stdio();
print "line 128";
chmod( 0666, $logfile );
print "line 130";
logmsg( "Server $basename Started Successfully.\n" );

Now I see:

Server nrecd started successfully. PID = 10698.
line 122line 124line 126

Which tells me that the issue is in the lock_stdio(); sub. This is close on to where I get stuck. I’m not a perl programmer but even to me all that sub looks stock standard – just redirecting the IO to /dev/null. I tried running it with perl -d but all I ended up doing was walking through the file line by line and learning nothing new.

The sub itself is:

sub lock_stdio {
    open( STDIN,  '<', '/dev/null'  ) or croak "Can't read /dev/null: $!";
    open( STDOUT, '>>', '/dev/null' ) or croak "Can't write to /dev/null: $!";
    open( STDERR, '>>', '/dev/null' ) or croak "Can't write to /dev/null: $!";
    return();
};

Is there anything someone can suggest in terms of working this out? If it really is isolated to that 3 line sub I feel ridiculous not being able to find the problem (as I said it look stock standard to me). Any help appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:06:34+00:00Added an answer on June 17, 2026 at 6:06 pm

    The problem isn’t in the lock_stdio sub, that’s just where your output stops going to the initial stdout and starts going to /dev/null.

    Try opening a different file:

    open my $debugfile, '>>', 'somefilename' or die "couldn't open debug file: $!\n";
    

    and write your debugging statements to that:

    print $debugfile "line xxx\n";
    

    Have you looked in the logfile it seems to have for any error messages?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.