Need help debugging rc script

From: Ultima <ultima1252_at_gmail.com>
Date: Thu, 1 Sep 2016 13:03:19 -0400
 Hello, I'm dealing with an odd issue with an rc script working pre-11. The
change that is causing the prog to fail seems to be the new limits feature,
$name_login_class. After commenting out the limits command in rc.subr, the
script starts as expected. Adding limits directly in the rc script with the
daemon class will also start the script as expected (with limits commented
out in rc.subr). For some reason that I cannot fathom it will just not
start correctly with limits in rc.subr.

 So as the topic suggests, are they're better way to debug this? I'll also
provide the scripts used in case someone may see something I'v missed. The
jail is running on current, however this exists in 11 as well.

12.0-CURRENT FreeBSD 12.0-CURRENT #21 r304105
audio/teamspeak3-server

# cat /usr/local/etc/rc.d/teamspeak
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: teamspeak
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# teamspeak_enable (bool):   Set to NO by default.
#               Set it to YES to enable teamspeak server.
#

. /etc/rc.subr

name="teamspeak"
rcvar=teamspeak_enable

db_dir=/var/db/teamspeak
log_dir=/var/log/teamspeak

pidfile=/var/db/teamspeak/teamspeak_server.pid
procname=/usr/local/libexec/ts3server
command=/usr/sbin/daemon
command_args="-fp $pidfile -u teamspeak /usr/local/libexec/ts3server
dbsqlpath=/usr/local/share/teamspeak/server/sql/
inifile=/usr/local/etc/teamspeak/ts3server.ini
licensepath=/usr/local/etc/teamspeak/ logpath=$log_dir"
teamspeak_chdir=$db_dir
required_dirs="$db_dir $log_dir"

load_rc_config $name

: ${teamspeak_enable="NO"}

LD_LIBRARY_PATH=/usr/local/lib/teamspeak/server:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

run_rc_command "$1"



This script causes an error,
2016-09-01 16:53:09.510292|ERROR   |DatabaseQuery |   |db_connect() failed
unable to open database file
2016-09-01 16:53:09.510352|CRITICAL|ServerLibPriv |   |Server()
DatabaseError out of memory


Commenting line 1075 in /etc/rc.subr, the program starts successfully....

Keeping line 1075 commented, change rc script to this.

# cat /usr/local/etc/rc.d/teamspeak
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: teamspeak
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# teamspeak_enable (bool):   Set to NO by default.
#               Set it to YES to enable teamspeak server.
#

. /etc/rc.subr

name="teamspeak"
rcvar=teamspeak_enable

db_dir=/var/db/teamspeak
log_dir=/var/log/teamspeak

pidfile=/var/db/teamspeak/teamspeak_server.pid
procname=/usr/local/libexec/ts3server
command=/usr/bin/limits
command_args="-C daemon /usr/sbin/daemon -fp $pidfile -u teamspeak
/usr/local/libexec/ts3server
dbsqlpath=/usr/local/share/teamspeak/server/sql/
inifile=/usr/local/etc/teamspeak/ts3server.ini
licensepath=/usr/local/etc/teamspeak/ logpath=$log_dir"
teamspeak_chdir=$db_dir
required_dirs="$db_dir $log_dir"

load_rc_config $name

: ${teamspeak_enable="NO"}

LD_LIBRARY_PATH=/usr/local/lib/teamspeak/server:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

run_rc_command "$1"


This is also start successfully.
Received on Thu Sep 01 2016 - 15:03:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:07 UTC