Service Script for Ubooquity (2.0.2)

Status
Not open for further replies.

ClayM

Explorer
Joined
Mar 4, 2013
Messages
67
Does anyone have a service script for Ubooquity in a FreeNAS jail?

I'm having trouble getting the stop/restart functionality running. Here's what I've got so far:

. /etc/rc.subr
name="ubooquity"
rcvar="${name}_enable"
load_rc_config ${name}

: ${ubooquity_enable:="NO"}
: ${ubooquity_user:="media"}
: ${ubooquity_group:="media"}
: ${ubooquity_dir:="/var/db/ubooquity"}
: ${ubooquity_jar:="/usr/local/share/ubooquity/Ubooquity.jar"}

pidfile="/var/run/ubooquity/ubooquity.pid"
#pidfile=$(ps ax | grep java | grep Ubooquity | awk '{ print $1 }')
#command="/usr/local/bin/java"
#command_args="/usr/local/share/ubooquity/ubooquity/SickBeard.py --datadir ${ubooquity_data_dir} -d --pidfile ${pidfile} -q --nolaunch"
#command_args="/usr/local/share/ubooquity/ubooquity.py --config ${ubooquity_config} --pidfile ${pidfile} --logfile ${ubooquity_log} --daemon --nobrowser"

command="/usr/sbin/daemon"
procname="/usr/local/bin/java"

#command_args="-f ${procname} -Dfile.encoding=UTF-8 -Duser.dir=${ubooquity_dir} -jar ${ubooquity_jar} -Djava.awt.headless=true --headless --remoteadmin 1> /dev/null 2> /dev/null &"
command_args="-f ${procname} -Dfile.encoding=UTF-8 -Duser.dir=${ubooquity_dir} -Djava.awt.headless=true -jar ${ubooquity_jar} --headless --remoteadmin"

start_precmd="ubooquity_prestart"
ubooquity_prestart() {
if [ -f ${pidfile} ]; then
rm -f ${pidfile}
echo "Removing stale pidfile."
elif [ ! -d ${pidfile%/*} ]; then
install -d -o $ubooquity_user -g $ubooquity_group ${pidfile%/*}
fi

if [ ! -d ${ubooquity_data_dir} ]; then
install -d -o ${ubooquity_user} -g ${ubooquity_group} ${ubooquity_data_dir}
fi
}

run_rc_command "$1"
 
D

dlavigne

Guest
If you start it manually, does it record a PID file to /var/run/ubooquity/ubooquity.pid?
 
D

dlavigne

Guest
In that case, replace the PID lookup with a grep of ps -acux that looks for the ubooquity process.
 

ClayM

Explorer
Joined
Mar 4, 2013
Messages
67
I'm doing pidfile=$(ps ax | grep java | grep Ubooquity | awk '{ print $1 }')

but it doesn't seem to get it / see it / locate it.

Is there a way to be more verbose or see what exactly "service" is doing with status / stop ?
 
D

dlavigne

Guest
Why look for a PID file if there is none to find? Instead, look for the process as suggested above.
 

ClayM

Explorer
Joined
Mar 4, 2013
Messages
67
I added a prestatus and get this:

/var/run # service ubooquity status
2743
ubooquity is not running.


so it's finding the pid but then failing the status check
 

ClayM

Explorer
Joined
Mar 4, 2013
Messages
67
Anyone else have an idea? I've got it setting the pidfile with

command_args="-f -p ${pidfile}

but status still returns as "not running" even though the PID is there and the service is actually running.
 
Status
Not open for further replies.
Top