View Single Post
Old 12-29-2019, 01:05 PM   #1
genoasalami
Connoisseur
genoasalami began at the beginning.
 
Posts: 53
Karma: 20
Join Date: Apr 2017
Device: KK3G, PW, Voyage, Oasis, Aura One, Forma
calibre-server demon won't load plugins

I'm running calibre-server 4.6 on FreeBSD, built from ports. The port comes with a startup script to run the server as a demon*. When the server is started this way, I cannot get custom plugins to load. However, when I manually simply run calibre-server from the command-line, everything is fine, and all the plugins load readily. This makes me think I'm missing something relatively simple, but I can't figure it out. I'd appreciate any help.

Here's the startup script:

rc.conf
Code:
#calibre settings
calibre_enable="YES"
calibre_flags="--disable-use-bonjour --auth-mode=basic --userdb=/usr/local/share/calibre/users.sqlite --enable-auth --log=/usr/local/share/calibre/logs/error.log --access-log=/usr/local/share/calibre/logs/access.log"
calibre_home="/usr/local/share/calibre/"
calibre_library="/mnt/library/"
calibre_user="root"
calibre_group="wheel"
startup script itself
Code:
#!/bin/sh
#
# $FreeBSD: head/deskutils/calibre/files/calibre.in 445400 2017-07-09 10:13:49Z madpilot $
#
# PROVIDE: calibre
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable calibre_server:
#
# calibre_enable (bool):        Set it to "YES" to enable calibre
#                               Default is "NO".
# calibre_port (int):		port that calibre_server listens on
#				Default is 8080
# calibre_user (string):	user that calibre_server runs as
#				Default is calibre
# calibre_home (string):	home directory for calibre_server
#				Default is the home directory of calibre_user
# calibre_url_prefix (string):  prefix to append to all URLs
#				default is unset
# calibre_logfile (string):	log file location
#				Default /var/log/calibre-server/calibre-server.log
# calibre_logsize (int):	size of log file before being rotated in MBs
#				Default 10 MB
# calibre_flags (string):	Any further flags to customize configuration
#				Default empty
# calibre_library (string):	path to library folder to serve content from
#
#
##########################################################

. /etc/rc.subr

name=calibre
rcvar=calibre_enable

load_rc_config $name

: ${calibre_enable:=NO}
: ${calibre_user:=calibre}
: ${calibre_library:=/nonexistent}
: ${calibre_logfile:=/var/log/calibre-server/calibre-server.log}
: ${calibre_logsize:=10}

pidfile=/var/run/${name}/${name}.pid
command=/usr/local/bin/calibre-server
command_interpreter=/usr/local/bin/python2.7
required_dirs=${calibre_library}

start_precmd=calibre_prestart

calibre_home=${calibre_home:-$(getent passwd ${calibre_user} | awk -F: '{print $6}')}
calibre_env="${calibre_env} HOME=${calibre_home:-/nonexistent}"

if [ ! -z "${calibre_port}" ]; then
	command_args="${command_args} --port=${calibre_port}"
fi
if [ ! -z "${calibre_url_prefix}" ]; then
	command_args="${command_args} --url-prefix=${calibre_url_prefix}"
fi

command_args="${command_args} --log ${calibre_logfile} --pidfile ${pidfile} --max-log-size ${calibre_logsize} --daemonize ${calibre_library}"

calibre_prestart()
{
	install -d -o ${calibre_user} -m 755 /var/run/${name}
	install -d -o ${calibre_user} -m 755 `dirname ${calibre_logfile}`
}

run_rc_command "$1"











* I recognize that this might be unsupported based on the fact the help options indicate that --daemonize is only support on Linux.

Last edited by genoasalami; 12-29-2019 at 01:07 PM.
genoasalami is offline   Reply With Quote