You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Vegar Westerlund <ve...@stud.ntnu.no> on 2008/09/03 10:44:42 UTC

Re: How to run Felix in background

honnix:
> Sahoo wrote:
>> honnix:
>>> Sahoo wrote:
>>>> honnix wrote:
>>>>> I'm a newbie with Felix. I just want to find out how to run Felix in
>>>>> background with my default profile.
>>>>>
>>>>> Something like this: *java -jar bin/felix.jar &
>>>>>
>>>>> *Is there a way?
>>>>
>>>> I guess you are concerned about Felix prompting you about the profile 
>>>> name. If you set felix.cache.profile or felix.cache.profiledir property 
>>>> in config.property file, then Felix won't prompt you anything and the 
>>>> command you mentioned would be sufficient.
>>>
>>> Thank you very much. I did as you said, but when I try to launch 
>>> Felix using java -jar bin/felix.jar &, it will be suspended in the 
>>> background, since it tries to get the input.
>>> [...]
>>> Then what if I don't want this terminal to be blocked, and only put 
>>> Felix to the background? Is this possible? I can do this with Equinox 
>>> by not giving -console argument.
>>
>> Yes, you can do something similar using Felix. Just disable the 
>> org.apache.felix.shell.tui bundle in conf/config.properties. Look for 
>> org.apache.felix.shell.tui*.jar in config.properties and remove that 
>> bundle from the autostart list.
>
> Thanks very much for your kindly help. I removed tui from
> conf/config.properties, and restarted Felix, tui was still running
> there, then I stopped it manually, and restarted Felix, and it was
> done.  Now I can put it to background successfully. ;-)

Is this the recommended way of running Felix as a daemon? Summary:

* Disable shell.tui (by removing the autoload paramater)
* Set felix profile (-Dfelix.cache.profile=<some-profile>)
* Redirect stdout and stderr to some log file ( >> felix.out 2>&1 )

e.g:
  (cd ~/felix-trunk/main; java -Dfelix.cache.profile=myProfile -jar bin/felix.jar) >> /var/log/felix.log 2>&1 &

Is there an init-script that does this (possibly in a cleaner way...)?

-- 
Vegar Westerlund

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: How to run Felix in background

Posted by Vegar Westerlund <ve...@stud.ntnu.no>.
Richard S. Hall:
> Vegar Westerlund wrote:
>> Richard S. Hall:
>>> Felix itself doesn't make any attempt to use stdin, but the simple 
>>> launcher does (i.e., it assumes it can ask for a profile if one doesn't 
>>> exist and is configured to autoload the shell.tui), but it is 
>>> configurable to avoid doing these things.
>>
>> «the simple laucher does...»? Is felix normally run from another
>> application (like I guess it is when running Eclipse)? I would like to
>> run Felix on a server to be a backend for business logic. And then I
>> only want to start the Felix server.
> 
> Well, we didn't expect there to be a single launcher that worked for 
> everyone, so we figured people might create their own launchers or embed 
> Felix into their own applications, see:

Ahh, ok. Helps to have some context information. The little I know about
Felix (first heard about it a little under a month ago so ...) I thought
running it as a server was the most common use-case.


>>> How would you like it to be cleaner? Do you mean having it set up as a 
>>> daemon automatically?
>>
>> Most programs designed to run as a daemon will ensure that stdout and
>> stderr are redirected to syslog (or a logfile) and stdout are closed
>> before forking a process to run in the background. And possibly a debug
>> mode where the console are kept as output. Thats what I was expecting,
>> but didn't find.
> 
> Well, for the most part, Felix uses the log service if a bundle is 
> installed that provides one, then you can control where the log messages 
> go via which log service you install.

Yeah, I know. That's not a problem. I was just wondering. Best practices
and so on...

>>> We have some work started on an installer that will automatically 
>>> install Felix as a daemon, but unfortunately that has stalled.
>>
>> Yeah, I read about something in the archive from November 07 about using
>> Java wrapper. I tried it out and it seems to work on our Linux server.
> 
> Cool. Well, it would be nice if we could find a volunteer to polish this 
> up. I created an issue for it on our "contributing" page:
> 
>    http://cwiki.apache.org/FELIX/contributing.html

I've never used wrapper before, but it work almost out of the box...


Thanks for really fast response. Always nice to meet an active
communitiy.

-- 
Vegar Westerlund

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: How to run Felix in background

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Vegar Westerlund wrote:
> Richard S. Hall:
>   
>> Felix itself doesn't make any attempt to use stdin, but the simple 
>> launcher does (i.e., it assumes it can ask for a profile if one doesn't 
>> exist and is configured to autoload the shell.tui), but it is 
>> configurable to avoid doing these things.
>>     
>
> «the simple laucher does...»? Is felix normally run from another
> application (like I guess it is when running Eclipse)? I would like to
> run Felix on a server to be a backend for business logic. And then I
> only want to start the Felix server.
>   

Well, we didn't expect there to be a single launcher that worked for 
everyone, so we figured people might create their own launchers or embed 
Felix into their own applications, see:

    http://cwiki.apache.org/FELIX/launching-and-embedding-apache-felix.html

>> How would you like it to be cleaner? Do you mean having it set up as a 
>> daemon automatically?
>>     
>
> Most programs designed to run as a daemon will ensure that stdout and
> stderr are redirected to syslog (or a logfile) and stdout are closed
> before forking a process to run in the background. And possibly a debug
> mode where the console are kept as output. Thats what I was expecting,
> but didn't find.
>   

Well, for the most part, Felix uses the log service if a bundle is 
installed that provides one, then you can control where the log messages 
go via which log service you install.

>> We have some work started on an installer that will automatically 
>> install Felix as a daemon, but unfortunately that has stalled.
>>     
>
> Yeah, I read about something in the archive from November 07 about using
> Java wrapper. I tried it out and it seems to work on our Linux server.
>   

Cool. Well, it would be nice if we could find a volunteer to polish this 
up. I created an issue for it on our "contributing" page:

    http://cwiki.apache.org/FELIX/contributing.html

:-)

-> richard

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: How to run Felix in background

Posted by Vegar Westerlund <ve...@stud.ntnu.no>.
Richard S. Hall:
> Vegar Westerlund wrote:
>> Is this the recommended way of running Felix as a daemon? Summary:
>>
>> * Disable shell.tui (by removing the autoload paramater)
>> * Set felix profile (-Dfelix.cache.profile=<some-profile>)
>> * Redirect stdout and stderr to some log file ( >> felix.out 2>&1 )
>>
>> e.g:
>>  (cd ~/felix-trunk/main; java -Dfelix.cache.profile=myProfile -jar 
>>  bin/felix.jar) >> /var/log/felix.log 2>&1 &
>>
>> Is there an init-script that does this (possibly in a cleaner way...)?
> 
> No, I think that is it. Now you might think about including shell.remote 
> so you can remotely access the Felix shell (or the web console).

Sure.

> Felix itself doesn't make any attempt to use stdin, but the simple 
> launcher does (i.e., it assumes it can ask for a profile if one doesn't 
> exist and is configured to autoload the shell.tui), but it is 
> configurable to avoid doing these things.

«the simple laucher does...»? Is felix normally run from another
application (like I guess it is when running Eclipse)? I would like to
run Felix on a server to be a backend for business logic. And then I
only want to start the Felix server.

> How would you like it to be cleaner? Do you mean having it set up as a 
> daemon automatically?

Most programs designed to run as a daemon will ensure that stdout and
stderr are redirected to syslog (or a logfile) and stdout are closed
before forking a process to run in the background. And possibly a debug
mode where the console are kept as output. Thats what I was expecting,
but didn't find.

> We have some work started on an installer that will automatically 
> install Felix as a daemon, but unfortunately that has stalled.

Yeah, I read about something in the archive from November 07 about using
Java wrapper. I tried it out and it seems to work on our Linux server.

-- 
Vegar Westerlund

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: How to run Felix in background

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Vegar Westerlund wrote:
> honnix:
>   
>> Sahoo wrote:
>>     
>>> honnix:
>>>       
>>>> Sahoo wrote:
>>>>         
>>>>> honnix wrote:
>>>>>           
>>>>>> I'm a newbie with Felix. I just want to find out how to run Felix in
>>>>>> background with my default profile.
>>>>>>
>>>>>> Something like this: *java -jar bin/felix.jar &
>>>>>>
>>>>>> *Is there a way?
>>>>>>             
>>>>> I guess you are concerned about Felix prompting you about the profile 
>>>>> name. If you set felix.cache.profile or felix.cache.profiledir property 
>>>>> in config.property file, then Felix won't prompt you anything and the 
>>>>> command you mentioned would be sufficient.
>>>>>           
>>>> Thank you very much. I did as you said, but when I try to launch 
>>>> Felix using java -jar bin/felix.jar &, it will be suspended in the 
>>>> background, since it tries to get the input.
>>>> [...]
>>>> Then what if I don't want this terminal to be blocked, and only put 
>>>> Felix to the background? Is this possible? I can do this with Equinox 
>>>> by not giving -console argument.
>>>>         
>>> Yes, you can do something similar using Felix. Just disable the 
>>> org.apache.felix.shell.tui bundle in conf/config.properties. Look for 
>>> org.apache.felix.shell.tui*.jar in config.properties and remove that 
>>> bundle from the autostart list.
>>>       
>> Thanks very much for your kindly help. I removed tui from
>> conf/config.properties, and restarted Felix, tui was still running
>> there, then I stopped it manually, and restarted Felix, and it was
>> done.  Now I can put it to background successfully. ;-)
>>     
>
> Is this the recommended way of running Felix as a daemon? Summary:
>
> * Disable shell.tui (by removing the autoload paramater)
> * Set felix profile (-Dfelix.cache.profile=<some-profile>)
> * Redirect stdout and stderr to some log file ( >> felix.out 2>&1 )
>
> e.g:
>   (cd ~/felix-trunk/main; java -Dfelix.cache.profile=myProfile -jar bin/felix.jar) >> /var/log/felix.log 2>&1 &
>
> Is there an init-script that does this (possibly in a cleaner way...)?
>   

No, I think that is it. Now you might think about including shell.remote 
so you can remotely access the Felix shell (or the web console).

Felix itself doesn't make any attempt to use stdin, but the simple 
launcher does (i.e., it assumes it can ask for a profile if one doesn't 
exist and is configured to autoload the shell.tui), but it is 
configurable to avoid doing these things.

How would you like it to be cleaner? Do you mean having it set up as a 
daemon automatically?

We have some work started on an installer that will automatically 
install Felix as a daemon, but unfortunately that has stalled.

-> richard

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org