FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 12-01-2009, 12:02 PM
Robert Bielik
 
Default Startup script issues

I'm converting Ubuntu startup scripts to work on CentOS (5.3), and I'm having trouble finding out how
to start a daemon in a certain directory? For Ubuntu, start-stop-daemon has the option -d to set the
working directory.

TIA
/Rob
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-01-2009, 01:46 PM
Brian Mathis
 
Default Startup script issues

On Tue, Dec 1, 2009 at 8:02 AM, Robert Bielik <robert.bielik@xponaut.se> wrote:
> I'm converting Ubuntu startup scripts to work on CentOS (5.3), and I'm having trouble finding out how
> to start a daemon in a certain directory? For Ubuntu, start-stop-daemon has the option -d to set the
> working directory.
>
> TIA
> /Rob

You could "cd" there in the script before starting it.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-01-2009, 02:56 PM
Robert Bielik
 
Default Startup script issues

Brian Mathis skrev:
> On Tue, Dec 1, 2009 at 8:02 AM, Robert Bielik <robert.bielik@xponaut.se> wrote:
>> I'm converting Ubuntu startup scripts to work on CentOS (5.3), and I'm having trouble finding out how
>> to start a daemon in a certain directory? For Ubuntu, start-stop-daemon has the option -d to set the
>> working directory.
>>
>> TIA
>> /Rob
>
> You could "cd" there in the script before starting it.

Wouldn't that just involve the session which starts the daemon, but not the daemon session itself? Or does
"daemon" startup the child session within the same working directory ?

/Rob

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-01-2009, 03:42 PM
Brian Mathis
 
Default Startup script issues

On Tue, Dec 1, 2009 at 10:56 AM, Robert Bielik <robert.bielik@xponaut.se> wrote:
> Brian Mathis skrev:
>> On Tue, Dec 1, 2009 at 8:02 AM, Robert Bielik <robert.bielik@xponaut.se> wrote:
>>> I'm converting Ubuntu startup scripts to work on CentOS (5.3), and I'm having trouble finding out how
>>> to start a daemon in a certain directory? For Ubuntu, start-stop-daemon has the option -d to set the
>>> working directory.
>>>
>>> TIA
>>> /Rob
>>
>> You could "cd" there in the script before starting it.
>
> Wouldn't that just involve the session which starts the daemon, but not the daemon session itself? Or does
> "daemon" startup the child session within the same working directory ?
>
> /Rob

It's helpful to understand that any child process started by a parent
process always inherits the environment of the parent. The cwd
(current working directory) is part of that environment. Any other
environment variables that are exported, such as PATH, etc.. are also
part of that environment.

So yes, the daemon process will start in the same directory that the
script is currently in, and assuming the daemon does not 'cd' by
itself, it should continue to run with that directory as the cwd.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-01-2009, 03:45 PM
Les Mikesell
 
Default Startup script issues

Robert Bielik wrote:
> Brian Mathis skrev:
>> On Tue, Dec 1, 2009 at 8:02 AM, Robert Bielik <robert.bielik@xponaut.se> wrote:
>>> I'm converting Ubuntu startup scripts to work on CentOS (5.3), and I'm having trouble finding out how
>>> to start a daemon in a certain directory? For Ubuntu, start-stop-daemon has the option -d to set the
>>> working directory.
>>>
>>> TIA
>>> /Rob
>> You could "cd" there in the script before starting it.
>
> Wouldn't that just involve the session which starts the daemon, but not the daemon session itself? Or does
> "daemon" startup the child session within the same working directory ?

Child processes inherit pretty much everything from their parent at the
time of the fork(), including the working directory. If they want to
change, they have to do it afterwards.

--
Les Mikesell
lesmikesell@gmail.com
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-01-2009, 04:03 PM
Robert Bielik
 
Default Startup script issues

Brian Mathis skrev:
> It's helpful to understand that any child process started by a parent
> process always inherits the environment of the parent. The cwd
> (current working directory) is part of that environment. Any other
> environment variables that are exported, such as PATH, etc.. are also
> part of that environment.
>
> So yes, the daemon process will start in the same directory that the
> script is currently in, and assuming the daemon does not 'cd' by
> itself, it should continue to run with that directory as the cwd.

Hmm.. yeah, my bad Of course the child process should inherit...

Thnx!
/R

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 06:22 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org