> On Sept. 20, 2013, 5:45 p.m., Steve Huston wrote: > > I don't see any handling for a QPID_FROM_INITD environment variable > > mentioned in the description. Am I missing something?
Sorry, I didn't update the description with the latest patch. The latest patch doesn't use that environment variable. - Ernie ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/14151/#review26298 ----------------------------------------------------------- On Sept. 20, 2013, 7 p.m., Ernie Allen wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/14151/ > ----------------------------------------------------------- > > (Updated Sept. 20, 2013, 7 p.m.) > > > Review request for qpid, Chug Rolke, Gordon Sim, and Ted Ross. > > > Repository: qpid > > > Description > ------- > > New solution suggested by Gordon Sim: > -------------------------------------------------- > - Don't use an environment variable in the init.d script > - Instead, add a getDefaultDataDir() to Broker::Options that contains all the > logic. This function checks the $HOME directory and doesn't append the .qpidd > to the default dataDir if home is /var/lib/qpidd. > > > Old description: > -------------------------------------------------- > Before 0.22, when the broker was started from the init.d script, the default > data-dir of /var/lib/qpidd was hard-coded in the init.d script. > > After https://bugzilla.redhat.com/show_bug.cgi?id=990972, the default > data-dir is NOT hard-coded in the init.d script. This allows the data-dir to > be picked up from /etc/qpid/qpidd.conf. However, the side-effect of that > change is that when qpidd is started as a service and no data-dir is > supplied, the data-dir is constructed to be /var/lib/qpidd/.qpidd. This is a > change in behavior. > > Proposed solution: > - Modify the init.d script to set an environment variable: QPID_FROM_INITD. > - If that environment variable exists don't append .qpidd to the data-dir. > > Other attempted solutions: > 1. Use the ppid to determine if qpidd was started as a service from the > init.d script. If the ppid is 1 then we were started by the init process as a > service. This didn't work because the ppid wasn't 1. It was a normal process > id. I suspect this is because the init process isn't the direct parent of > qpidd. > > 2. Inspect /var/run/qpidd.pid and compare it's contents to our pid. This > didn't work because /var/run/qpidd.pid was empty at the time it was > inspected. After qpidd starts /var/run/qpidd.pid contains the correct pid, > but during startup it is empty. > > 3. Pass a new command line switch that indicates qpidd was started from the > init.d file. This would work but has the problem of having to hide the new > command line switch from the usage text and passing it to the proper > constructor. This is much more involved than the environment variable. > > > > > Diffs > ----- > > /trunk/qpid/cpp/src/qpid/broker/Broker.h 1523729 > /trunk/qpid/cpp/src/qpid/broker/Broker.cpp 1523729 > /trunk/qpid/cpp/src/qpid/broker/posix/BrokerDefaults.cpp 1523729 > /trunk/qpid/cpp/src/qpid/broker/windows/BrokerDefaults.cpp 1523729 > > Diff: https://reviews.apache.org/r/14151/diff/ > > > Testing > ------- > > Verified that: > When started from the command line without specifying a data-dir, the store > files should be under $HOME/.qpidd > When started from the command line with a data-dir, the store files should be > directly under the specified data-dir. > When started from the init.d script without specifying a data-dir, the store > files should be under $HOME (/var/lib/qpidd) > When started from the init.d script with a data-dir (from sysconfig), the > store files should be directly under data-dir. > > When started from the command line, the data-dir can be specified using > - the command line switch --data-dir > - the environment variable QPID_DATA_DIR > - the config file entry data-dir= > > When starting from the init.d script, the data-dir can be specified by > - exporting the QPID_DATA_DIR environment variable in /etc/sysconfig/qpidd > - using the config file entiry data-dir= > > > Thanks, > > Ernie Allen > >
