<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: init.rc script fails because tty detach in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583896#M103701</link>
    <description>If you must daemonize a process using a scripting language then Perl is your best bet. It lets you use setsid() to detach the process from a controlling terminal. Try the attached Perl script and make your changes in the "exec" function. The idea is that the process forks() then the parent is allowed to exit; the child then sets up any signal handlers and does an exec(). It's also a good idea for all daemons to to a cd to / so that umounts won't fail with "device busy".&lt;BR /&gt;</description>
    <pubDate>Mon, 18 Jul 2005 16:19:22 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2005-07-18T16:19:22Z</dc:date>
    <item>
      <title>init.rc script fails because tty detach</title>
      <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583884#M103689</link>
      <description>we tried to set an init script to start an application on system boot using an init script (rc).&lt;BR /&gt;&lt;BR /&gt;The process starts but is killed by the next inittab line: getty console.&lt;BR /&gt;&lt;BR /&gt;Is there any way to "demonize" the process and then detach it from the console.&lt;BR /&gt;&lt;BR /&gt;I tried to "nohup" the script but it fails to detach the process from console.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Manoj</description>
      <pubDate>Fri, 15 Jul 2005 18:43:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583884#M103689</guid>
      <dc:creator>manoj_pu</dc:creator>
      <dc:date>2005-07-15T18:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: init.rc script fails because tty detach</title>
      <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583885#M103690</link>
      <description>I couldn't understand why you want to start the script using inittab entry, is it a specific requirement? &lt;BR /&gt;&lt;BR /&gt;May be your script is starting the process too early (that means at a point where other necessary system process still to start) and thats why it is getting killed. &lt;BR /&gt;&lt;BR /&gt;Try starting the script manually after the system is booted. If this works fine put your script in /sbin/init.d folder and then create a link from /sbin/rc2.d. Adjust the link name so as to run it at the last of run level 2. Link name should be in Sxxx format.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;&lt;BR /&gt;Sudeesh</description>
      <pubDate>Fri, 15 Jul 2005 19:35:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583885#M103690</guid>
      <dc:creator>Sudeesh</dc:creator>
      <dc:date>2005-07-15T19:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: init.rc script fails because tty detach</title>
      <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583886#M103691</link>
      <description>does your process have a need for console access ? And why does it need to start before the console getty process ? Or is it getting killed because it is conflicting with getty for console resource ?&lt;BR /&gt;&lt;BR /&gt;I am not sure what process needs to be started this early in the boot-up sequence but if you just time the start of your program, and run it on the background with nohup, there should not be any problems.</description>
      <pubDate>Fri, 15 Jul 2005 20:08:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583886#M103691</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2005-07-15T20:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: init.rc script fails because tty detach</title>
      <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583887#M103692</link>
      <description>So doing a 'nohup &lt;PROCESS&gt; &amp;amp;' doesn't work?&lt;BR /&gt;&lt;BR /&gt;What are you trying to daemonize anyway?&lt;/PROCESS&gt;</description>
      <pubDate>Sun, 17 Jul 2005 06:28:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583887#M103692</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2005-07-17T06:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: init.rc script fails because tty detach</title>
      <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583888#M103693</link>
      <description>Oh, I should probably expand on that a bit further.&lt;BR /&gt;&lt;BR /&gt;Some applications grab STDIN, STDOUT and STDERR rather firmly when they start, even if they are backgrounded.  Sometimes you need to force thse file-descripters to go elsewhere, i.e.:&lt;BR /&gt;&lt;BR /&gt;nohup processname &amp;lt; /dev/null &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&lt;BR /&gt;&lt;BR /&gt;But tell us what you're trying to background like this in the RC scripts, and we'll see if there's a better way.</description>
      <pubDate>Sun, 17 Jul 2005 06:31:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583888#M103693</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2005-07-17T06:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: init.rc script fails because tty detach</title>
      <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583889#M103694</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Could delaying the script for sometime will help ? I would thought of giving it a try. Delay the script for atleast 10-20 secs for it to start before proceding to execute the next script.&lt;BR /&gt;&lt;BR /&gt;But can not it be done by putting it somewhere in /sbin/init.d and link to required runlevel as Sudeesh mentioned. A brief desciption of what you are trying to achive will help us a bit to help you better.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Devender</description>
      <pubDate>Sun, 17 Jul 2005 08:18:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583889#M103694</guid>
      <dc:creator>Devender Khatana</dc:creator>
      <dc:date>2005-07-17T08:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: init.rc script fails because tty detach</title>
      <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583890#M103695</link>
      <description>Hi Manoj,&lt;BR /&gt;&lt;BR /&gt;As Sudeesh suggested the best way would be to try the script once the system is booted. If the script works fine the you can use the template in /sbin/init.d to customize your script. Then based on requirement of the script place it in either rc2.d/rc3.d/...&lt;BR /&gt;&lt;BR /&gt;Cheers!!!&lt;BR /&gt;eknath</description>
      <pubDate>Sun, 17 Jul 2005 22:06:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583890#M103695</guid>
      <dc:creator>Eknath</dc:creator>
      <dc:date>2005-07-17T22:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: init.rc script fails because tty detach</title>
      <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583891#M103696</link>
      <description>I am trying to start xvfb (xserver) and mwm xserver manager by using init.rc in the system startup.&lt;BR /&gt;&lt;BR /&gt;Same startup script works fine if I run manually.&lt;BR /&gt;&lt;BR /&gt;startup script - /sbin/init.d/xvfb&lt;BR /&gt;and it is link to /sbin/rc3.d/S995xvfb&lt;BR /&gt;&lt;BR /&gt;Now the problem is:&lt;BR /&gt;When system starts script starts xvfb and mwm, below is the process details&lt;BR /&gt;&lt;BR /&gt;â  root 4886 1 0 22:31:14 console 0:03 /usr/bin/X11/X :10 -ac -fbdir /var/X11/Xserverâ  &lt;BR /&gt;&lt;BR /&gt;â  root 4890 1 0 22:31:44 console 0:00 /usr/bin/X11/mwm -display :10â  &lt;BR /&gt;&lt;BR /&gt;This process status remain same untill the system console login prompt comes.&lt;BR /&gt;&lt;BR /&gt;After that xvfb remain running with below process status and mwm process automatically dies.&lt;BR /&gt;&lt;BR /&gt;root 4886 1 0 22:31:14 ? 0:03 /usr/bin/X11/X :10 -ac -fbdir /var/X11/Xserver&lt;BR /&gt;&lt;BR /&gt;Please tell me how to "demonize" the mwm process and then detach it from the console as what is happening with xvfb automatically.&lt;BR /&gt;&lt;BR /&gt;Thanks and Regards&lt;BR /&gt;&lt;BR /&gt;Manoj&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Jul 2005 11:26:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583891#M103696</guid>
      <dc:creator>manoj_pu</dc:creator>
      <dc:date>2005-07-18T11:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: init.rc script fails because tty detach</title>
      <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583892#M103697</link>
      <description>&lt;BR /&gt;Just repeating&lt;BR /&gt;&lt;BR /&gt;xvfb &amp;amp; mwm process status&lt;BR /&gt;&lt;BR /&gt;before system console login prompt comes&lt;BR /&gt;&lt;BR /&gt;root 4886 1 0 22:31:14 console 0:03 /usr/bin/X11/X :10 -ac -fbdir /var/X11/Xserver&lt;BR /&gt;&lt;BR /&gt;root 4890 1 0 22:31:44 console 0:00 /usr/bin/X11/mwm -display :10&lt;BR /&gt;&lt;BR /&gt;After system console login prompt comes&lt;BR /&gt;only xvfb survive and mwm dies&lt;BR /&gt;&lt;BR /&gt;root 4886 1 0 22:31:14 ? 0:03 /usr/bin/X11/X :10 -ac -fbdir /var/X11/Xserver&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards &lt;BR /&gt;&lt;BR /&gt;Manoj&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Jul 2005 11:35:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583892#M103697</guid>
      <dc:creator>manoj_pu</dc:creator>
      <dc:date>2005-07-18T11:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: init.rc script fails because tty detach</title>
      <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583893#M103698</link>
      <description>Manoj,&lt;BR /&gt;&lt;BR /&gt;I am under the impression that you have not tried the nohup option yet. Did you ?&lt;BR /&gt;&lt;BR /&gt;in your startup script, make sure you have somthing like this :&lt;BR /&gt;&lt;BR /&gt;DISPLAY=`/usr/bin/hostname`:10; export DISPLAY&lt;BR /&gt;nohup sh -c '/usr/bin/X11/Xvfb :10 -ac \&lt;BR /&gt;-fbdir /var/X11/Xserver &amp;amp; ; \&lt;BR /&gt;sleep 5; /usr/bin/X11/xhost + ; \&lt;BR /&gt;/usr/bin/X11/mwm &amp;amp;' &amp;gt; /dev/null&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Jul 2005 12:30:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583893#M103698</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2005-07-18T12:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: init.rc script fails because tty detach</title>
      <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583894#M103699</link>
      <description>Burslan,&lt;BR /&gt;&lt;BR /&gt;You are exactly right.&lt;BR /&gt;&lt;BR /&gt;But that does not work to "demonize" the mwm process in the system startup.&lt;BR /&gt;&lt;BR /&gt;Do you have any other catch on it???&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Jul 2005 12:58:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583894#M103699</guid>
      <dc:creator>manoj_pu</dc:creator>
      <dc:date>2005-07-18T12:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: init.rc script fails because tty detach</title>
      <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583895#M103700</link>
      <description>To the best that I know daemons are written, compiled and linked to be daemons. You can not just expect any executable to be run as a daemon in the full meaning of it. nohup and running it in the background as a detached process is the best thing you can do without re-writing the whole program yourself.&lt;BR /&gt;&lt;BR /&gt;Some programs have the option of running themselves ad daemons, like sendmail, with proper command switches but a quick glance over mwm does not show anything close to this.&lt;BR /&gt;&lt;BR /&gt;Also, running a process in the background, doing whatever you are expecting from it to do, is not much different than the actual daemon functionality, maybe with a bit of extra overhead due to shell handling etc. What else are you after by runnig it as a *true* daemon ?</description>
      <pubDate>Mon, 18 Jul 2005 13:52:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583895#M103700</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2005-07-18T13:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: init.rc script fails because tty detach</title>
      <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583896#M103701</link>
      <description>If you must daemonize a process using a scripting language then Perl is your best bet. It lets you use setsid() to detach the process from a controlling terminal. Try the attached Perl script and make your changes in the "exec" function. The idea is that the process forks() then the parent is allowed to exit; the child then sets up any signal handlers and does an exec(). It's also a good idea for all daemons to to a cd to / so that umounts won't fail with "device busy".&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Jul 2005 16:19:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583896#M103701</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-07-18T16:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: init.rc script fails because tty detach</title>
      <link>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583897#M103702</link>
      <description>All,&lt;BR /&gt;&lt;BR /&gt;Finally the the story end successfully!!!&lt;BR /&gt;Special thanks to Stephenson for wonderful perl script.&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; Best Regards&lt;BR /&gt;&lt;BR /&gt;Manoj&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Jul 2005 07:28:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/init-rc-script-fails-because-tty-detach/m-p/3583897#M103702</guid>
      <dc:creator>manoj_pu</dc:creator>
      <dc:date>2005-07-19T07:28:11Z</dc:date>
    </item>
  </channel>
</rss>

