[CentOS] /etc/rc5.d

Bowie Bailey Bowie_Bailey at BUC.com
Thu Sep 11 13:38:15 UTC 2008


tony.chamberlain at lemko.com wrote:
> 
>       start() {
>                 date >> /root/joe.log
>                 /usr/bin/joevpn start &
>                 RES=$?
>                 return $RES
>       }
> 
> This all works and everything.  I am just curious as to why when I do
> a ps I get this:
>         /bin/bash /etc/rc5.d/S99runjoevpn
> 
> Shouldn't that init script terminate since I have an "&" when I do the
> start() function above? No other rc5 stuff (i.e. tomcat for instance)
> shows up in the ps, though tomcat is running, it started up and
> returned. Is this OK or am I missing something?

The "&" doesn't terminate anything.  It simply moves the process to the
background and leaves it attached to the parent process.  The parent
process cannot exit until all of its child processes exit.  What you are
looking for is this:

   start() {
             date >> /root/joe.log
             nohup /usr/bin/joevpn start &
             RES=$?
             return $RES
   }

The "nohup" command will detach the joevpn process from the parent and
allow the parent process to exit.

-- 
Bowie


More information about the CentOS mailing list