Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#76 Install a Linux daemon without the "wrapper.config" property

open
nobody
None
5
2013-01-09
2013-01-09
Maciej Kucharski
No

Hi,

I am using the YAJSW as a library in my project. I have my own configuration mechanism which I translate to YAJSW specific (within the code - without any YAJSW configuration files). This works fine under Windows. Unfortunately not on Linux.

When I try to create a Linux daemon using following method (I supply a valid configuration properties):

org.rzo.yajsw.wrapper.WrappedServiceFactory.createService( Map map)

I get a warning in

org.rzo.yajsw.os.posix.PosixService.init()

...
String confFile = _config.getString("wrapper.config");
String confDir = null;
if (confFile != null)
{
File f = new File(confFile);
if (f.exists())
try
{
confDir = f.getParentFile().getCanonicalPath();
}
catch (IOException e)
{
}
}
if (confDir == null)
confDir = wrapperHome + "/conf";
if (confFile == null)
{
_logger.warning("no conf file found -> abort");
return;
}
...

It seems that a configuration file is expected regardless that I supply all the configuration properties in the "map" parameter. On Windows there is no such problem because all the configuration properties are copied into the Windows service execution command.

Should not the library behave the same for different OS?

Best regards,
Maciej

Discussion

    • summary: It is impossible to install a Linux daemon without the "wrap --> Install a Linux daemon without the "wrapper.config" property
     
  • rzo
    rzo
    2013-01-10

    hello,

    yes, you are right. i currently do not remember why there is a difference between windows and posix. i will have to check this out.
    in the mean time could you pls provide some more information on what your code is doing.
    if i understand it correctly you are programmatically configuring a service/daemon and installing it.

    -- Ron

     
  • Yes, I do everything "in the code" - I have no configuration files.
    Following snippet demonstrates what I do:

    import java.util.Map
    import org.rzo.yajsw.wrapper.WrappedService;
    import org.rzo.yajsw.wrapper.WrappedServiceFactory;

    class Snippet
    {
    private final WrappedService service;

    public Snippet( Map< String, String > aYajswConfiguration )
    {
    service = (WrappedService)WrappedServiceFactory.createService( aYajswConfiguration ); //here I get a warning: "no conf file found -> abort"
    }

    public void install() throws ServiceException
    {
    boolean installed = service.install(); //this returns "false" because the "init" was not complete
    if( !installed )
    {
    throw new ServiceException();
    }
    }
    }

    The specified "aYajswConfiguration" configuration parameter is a valid YAJSW configuration.