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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:37:52+00:00 2026-06-07T11:37:52+00:00

while working with an old initscript in redhat, I came across the line like

  • 0

while working with an old initscript in redhat, I came across the line like

daemon --user $USER --pidfile $PIDFILE "cmd >>/var/log/cmd.log 2>&1 &"

It seemed to be suspicious in that it does not use nohup. However the program works correctly, and stays up running even if the controlling terminal is exited. Investigating further I found that a command e.g bash -c 'sleep 1000&' seems to stay up even if the terminal from which it is invoked is exited (which shouldn’t have been possible without nohup). I verified this behavior with latest ubuntu.

So my question is, is this behavior well known? that is, can I use it in my init script rather than using nohup? or is it a bug in bash?

  • 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-07T11:37:55+00:00Added an answer on June 7, 2026 at 11:37 am

    This piqued my curiosity: does SIGHUP behave like it used to? The first clue comes from the bash man page on shopt:

    huponexit If set, bash will send SIGHUP to all jobs when an interactive login shell exits.

    On a vanilla Ubuntu 12.04 installation, huponexit defaults to “off” even for an interactive session. Being a empiricist, I wanted to see it in action:

    #include <stdio.h>
    #include <stdlib.h>
    #include <signal.h>
    #include <unistd.h>
    
    void
    hupped(int i)
    {
        fprintf(stderr, "received SIGHUP 0x%x\n", i);
        exit(1);
    }
    
    int main(int argc,char * argv[])
    {
        fprintf(stderr, "registering SIGHUP handler for PID %d\n", getpid());
        signal(SIGHUP, hupped);
        sleep(3600*5);
        return 0;
    }
    

    Even with stdin and stdout bound to a tty, it never receives a signal upon shell exit, which agrees with the documentation. As expected, the process becomes a child of init, and the connections to the pty are closed.

    Judging from its defaults, SIGHUP is not considered “interesting” to bash interactive sessions. However, as soon as you depend on this, you’ll find a counter-example, most likely at the worst possible time.

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

Sidebar

Related Questions

While working away on an old piece of code I came across something like
While working my way through the Android tutorials, I came across something I don't
While working with xcode, I saw a new line jmUIImage and i try to
I'm working on a 10-year-old Java webapp, and I would like to introduce some
I have just been re-working an old bit of compiler-like code written using bison.
While working a project tonight, I ended up using one .js resource file for
While working with Java, I find it hard to position my main window in
While working with git-svn, and a 'typical' svn repo /trunk, /branches/..., /tags/... How do
While working on an Xcode project i keep getting the spinning wheel while switching
While working with NSDate, sometimes the time zones are different. But I don't mess

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.