Foreword: I have already resolved this problem and am asking this question to share the solution I've found. Please bear in mind that the problem described here may (or may not) be more generic and could apply not only to Bacula but to other services as well. It might also be Debian-specific as this seems to be the matter of packaging but I currently cannot test it on any other distro.
The question:
Setting up a Bacula installation I've encountered a peculiar behaviour of the file daemon:
/etc/init.d/bacula-fd start
starts the daemon OK/etc/init.d/bacula-fd stop
fails to stop the daemon- consequently
/etc/init.d/bacula-fd restart
fails as well (PID doesn't change), so new config does not apply /etc/init.d/bacula-fd status
returnsbacula-fd is not running ... failed!
even thoughps aux | grep bacula-fd
shows the daemon is in fact running
The PID file is present where it is configured to reside and its content is correct.
The system is Debian Wheezy, Bacula version is 5.2.6 (the latest available in Wheezy repository).
The problem only exists on some of the machines where Bacula is installed, on several others it works just fine.
The FileDaemon section from /etc/bacula/bacula-fd.conf
on an affected machine:
FileDaemon { Name = (name here) FDAddress = (public IP here) FDport = 13802 WorkingDirectory = /var/lib/bacula Pid Directory = /var/run/bacula Maximum Concurrent Jobs = 20 }
And one from an unaffected machine:
FileDaemon { Name = (name here) FDport = 9102 WorkingDirectory = /var/lib/bacula Pid Directory = /var/run/bacula Maximum Concurrent Jobs = 20 FDAddress = 192.168.1.10
If I don't get this resolved I cannot employ scripts to automatically apply configuration changes on all my Bacula machines. What could possibly be the cause of this behaviour and how do I resolve this?
Best Answer
The problem is partly within the configuration files and partly elsewhere. On some of the 20 machines where Bacula was installed I have altered the default port on which bacula-fd is listening (had reasons for that) and this proved to be the root of the problem. As for the
/etc/bacula/bacula-fd.conf
the relevant line is this one:FDport = 13802
.The thing is
/etc/init.d/bacula-fd
has the port hard-coded (and additionally overwritten by a value returned bygetent services bacula-fd
call) and does not extract it from the bacula-fd configuration file. This does not prevent the init.d script from starting the daemon but causes problems checking its state, stopping and, consequently, restarting.In order to get this solved I modified the
/etc/init.d/bacula-fd
changingPORT=9102
to the correct port number:PORT=13802
. Additionally I edited the/etc/services
file, found the relevant lines and modified them as follows:Now the
/etc/init.d/bacula-fd
script works like charm.