On 01/04/2016 07:26 PM, Daniel Bareiro wrote:
> On 04/01/16 13:19, Peter Keller wrote:
>> since they were missing the LSB stuff and the creation of the pidfile 
>> directory
>> and subsys directory. I found that they would work when tested by hand, but 
>> not
>> during actual reboots until I had made code changes and fixed the behavior.
> 
> Yes, I have noticed that after a restart, both processes were not able
> to start and this was because the "bacula" directory I had manually
> created in /var/run had disappeared. How you handle this?

It disappears because /var/run is often on a ramdisk so when
the machine reboots the data is lost forever. AFAICT, most startup scripts
simply mkdir the appropriate directories they need in /var/run and chmod and
chown them to be whatever they need to be.

> The startup scripts in the Debian packaged version uses a
> "create_var_run_dir" function but I don't see its definition within the
> scripts.

I personally think the bacula startup scripts need to create the directories
leading up to the PIDFILE and SUBSYSDIR and ensure they are owned properly.
They currently don't (by inspection).

In my setup, the Director and Storage daemons are run as the 'bacula' user and
only the File Daemon is root. All bacula config files (and ssl certs which
are bacula related) are owned by 'bacula' in group 'bacula' and are mode 640.
All directories like /var/log/bacula/, /var/run/lock/bacula/, and such
are bacula.bacula and 750.

My personal preference for how bacula is installed on a machine did
not match the defaults bacula chooses. I ended up specifying a pile of
arguments to ./configure to spread the installed files around like more
traditional unix applications do.

In addition to the LSB info block, I ended up adding this after the respective
variable definition block in each bacula startup script.

mkdir -p ${PIDDIR} ${SUBSYSDIR}
chown -R bacula.bacula ${PIDDIR} ${SUBSYSDIR}
chmod -R 750 ${PIDDIR} ${SUBSYSDIR}

That ensures that each startup script created those directories and the races
didn't matter since all interleaved control paths lead to the same thing in
the file system.

Others on this list may disagree with how I chose to do things and since I'm
new to Bacula, I'm sure they'll have good advice. 7.2.0 wasn't in the repos I
needed and compiling it by hand caused me to take many steps to create an
install in the manner I thought appropriate. YMMV.

It does seem, though, that I didn't know about 'make install-autostart'.
I'm somewhat surprised since usually the /etc/init.d scripts are
installed by 'make install' in most other unix packages so I wasn't
expecting there to be a special make target for it. I'll have to
figure that out and see if it removes some of the work I was doing
by hand.

However, an inspection of those debian specific startup scripts
just now still leaves out the mkdir/chown/chmod block I need and it
doesn't depend on postgres or mysql in the LSB block (and it doesn't
seem that it can algorithmically choose), so it appears that needs
to be fixed anyway....

> Thank you very much for your suggestions! They were very helpful!

I'm glad it worked out, thanks!

Later,
-pete


------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to