[FreeNAS] Problem starting bareos-fd at boot

Hi,

I'm new to FreeBSD and have troubles with starting bareos-fd at system startup. I'm using FreeNAS 9.1.1 which uses FreeBSD 9.1. I recently compiled Bareos on a FreeBSD 9.1 system and installed it in a jail on FreeNAS.

The problem now is that Bareos is not starting after a reboot. Here are the steps I did so far:
  • Add the following lines to /etc/rc.conf
    Code:
    bareos-fd_enable="YES"
    bareos-sd_enable="YES"
  • Add the files bareos-fd and bareos-sd into /usr/local/etc/rc.d
    Code:
    #! /bin/sh
    #
    # bareos       This shell script takes care of starting and stopping
    #              the bareos File daemon.
    #
    #  For Bareos release 12.4.4 (12 June 2013) -- freebsd
    #
    # PROVIDE: bareos-fd
    #
    . /etc/rc.subr
    name="bareos-fd"
    rcvar="bareos-fd_enable"
    command="/opt/bareos/sbin/bareos-fd"
    load_rc_config $name
    run_rc_command "$1"
If I try to start it manually I get the following error:
Code:
# ./bareos-fd onestart
/etc/rc.conf: bareos-fd_enable=YES: not found
/etc/rc.conf: bareos-sd_enable=YES: not found
eval: bareos-fd_enable=YES: not found
./bareos-fd: WARNING: $bareos-fd_enable is not set properly - see rc.conf(5).
Cannot 'start' bareos-fd. Set bareos-fd_enable to YES in /etc/rc.conf or use 'onestart' instead of 'start'.

If I use the command to check rcvar I get the following error

Code:
# service bareos-fd rcvar
/etc/rc.conf: bareos-fd_enable=YES: not found
/etc/rc.conf: bareos-sd_enable=YES: not found
/etc/rc.conf: bareos-fd_enable=YES: not found
/etc/rc.conf: bareos-sd_enable=YES: not found
# bareos-fd
#
bareos-fd_enable="-fd_enable"
# - -fd_enable_desc
#   (default: "-fd_enable_defval")

Any idea what I did wrong? Is it now allowed to user "-" in service names?

Regards,

Günter
 
Yep, the rc(8) scripts do not like dashes in variables (it's a shell restriction actually). Change it to bareos_fd_enable and bareos_sd_enable and it should work.

Also note that you're not setting them to NO by default.

Code:
: ${bareos_sd_enable:=NO}
: ${bareos_fd_enable:=NO}
 
Thanks for all your quick answers!

@DutchDaemon: As I said I'm new to FreeBSD. I didn't post it to the FreeNAS forum because I think it's not a FreeNAS problem. I think it's a problem of the shell which is implemented in FreeBSD. Or better I should say it's my problem of not knowing the shell very well.

I'll try to replace "-" by "_".
 
Last edited by a moderator:
Back
Top