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 7591669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:42:30+00:00 2026-05-30T20:42:30+00:00

I needed to replace a radius autentification script (for PPPoE connections). This is a

  • 0

I needed to replace a radius autentification script (for PPPoE connections). This is a heavily used service that runs 24/7, so to test the new script I injected a small code in the begining of the original script to fork a new process that called the new script (without the danger of breaking something if the new script failes). This is the injected code:

$pid =  fork();
if($pid == 0)
{
    my $now_string = POSIX::strftime "%a %b %e %H:%M:%S %Y", localtime;
    open(FILE,">>/new_log_file.log");
    `/new_script_path/new_script.pl @ARGV`;
    if ($? == 0)
    {
        print FILE "[".$now_string."] Chiled executed succesfuly\n";
    } elsif($? == -1)
    {
        print FILE "[".$now_string."] FAILED to execute\n";
    } elsif($? & 127)
    {
       printf FILE "[".$now_string."] child died with signal %d, %s coredump\n", ($? & 127), ($? & 128) ? 'with' : 'without';
    } else
    {
       printf FILE "[".$now_string."] child exited with value %d\n", $? >> 8;
    }
    close(FILE);
    exit;
}

Unfortunately this failed to execute the new script and in the log files I had this message:

"[Mon Feb 27 09:25:10 2012] child exited with value 5"

Without shifting the bits, the value of $? is 1280;

The new script works as expected if I manualy call it.

What does status code 5 means ?
How can I debug the command in the backtick to find out what’s going wrong ?

  • 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-05-30T20:42:31+00:00Added an answer on May 30, 2026 at 8:42 pm

    After a lot of search I finaly found the way to debug it. Look at the new code:

    my $now_string = POSIX::strftime "%a %b %e %H:%M:%S %Y", localtime;
    open(FILE,">>/new_log_file.log");
    $output = `/new_script_path/new_script.pl @ARGV 2>&1`;
    if ($? == 0)
    {
        print FILE "[".$now_string."] Chiled executed succesfuly\n";
    } elsif($? == -1)
    {
        print FILE "[".$now_string."] FAILED to execute\n";
    } elsif($? & 127)
    {
       printf FILE "[".$now_string."] child died with signal %d, %s coredump\n", ($? & 127), ($? & 128) ? 'with' : 'without';
    } else
    {
       printf FILE "[".$now_string."] child exited with value %d (%d) [ %s ]\n", $? >> 8, $?, $output;
    }
    close(FILE);
    

    What I did is capture the STDOUT and STDERR of the command in the backtick (documentation here ), and print it in the log file.

    Now I found this message in the log file, and found what was wrong:

    [Mon Feb 27 09:40:41 2012] child exited with value 2 (512) [ Can't locate lib.pl in @INC (@INC contains: [long output removed] ) at /new_script_path/new_script.pl line 30.
    

    I answered the question, of how to debug it ( the strange part is that with this new code the status code is 2 not 5 )

    In the hope this will help others I will tell you what were my 2 mistakes (please correct me if i’m wrong):

    1. I loaded a lib without the full path.
    2. When I manualy tested the new script, I only called him from the same directory where it resides.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I needed to find all the files that contained a specific string pattern. The
I needed a generic collection or list that can fire an event when an
What is the correct jquery statement to replace the //Needed magic comments below so
I'm trying to create views that would accumulate all the needed data from joined
I had a model with some nested attributes and needed to add new items
I have multiple line string that I'd like to replace, but don't understand why
I just had a task in where I needed to replace each 3rd value
How fast can I replace characters in a string? So the background on this
I have a working reg expression that does a replace function based on the
... ok ... so ... i just needed to clear cache after all that.

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.