in reply to FR Reload Issues

You're not checking the return value from your call to system. Try something like this:

system("sudo ssh $addr $reloadcmd") && die("Failed to 'sudo ssh $addr $reloadcmd': $?");

That should give you some idea what's going on.

For more information about dealing with errors from system(), see the system() docs in perlfunc:

   $ perldoc -f system

-sam

Replies are listed 'Best First'.
Re^2: FR Reload Issues
by amt (Monk) on Nov 03, 2004 at 18:14 UTC
    samtregar, thank you for the direction. This was intent of this post, not the knock em dead answer.

    cheers.
    Update
    Taking your suggestion, I am returned with:
    Failed to 'sudo ssh 192.168.1.243 /usr/local/sbin/rc.radiusd reload > +/tmp/reload_ouput': 0 at /usr/local/nagios/perl/radpass.pl line 1184.

    I don't understand why I could be getting a 0 for $?. I tried removing the redirection of the output, but I still get 0. My system call isn't returning a -1, so it's being accepted.
    amt.

    perlcheat
      Try replacing the command with something simpler like:

      system("sudo ssh $addr echo Hello") && die("Failed to 'sudo ssh $addr echo Hello': $?");

      If that works then you know the problem isn't with sudo or ssh. You need to look at $reloadcmd and figure out why it's failing. You haven't told us anything about this code so it's hard to know why it might exit(0).

      -sam

        samtregar, I did replace the complex command with a simpler command. I replaced it with touch and the touch command executed, I thought that I mentioned that in my first post, that is why I am so baffled at why it is exit(0). I have also tried redirecting the output of the execution to a file, and the remote server doesn't create that file, but the localhost does.

        I am logging into the remote server with a SSH key as root, when I'm executing that command, so I don't know why the command would fail.
        amt.

        perlcheat