Libreoffice daemon in rc script does not work (shell expansion problem)

Jose Garcia Juanino jjuanino at gmail.com
Sun Mar 25 18:22:47 UTC 2012


Hi,

I am trying to make an rc script to start libreoffice daemon. The aim is
convert Open Document files to PDF, HTML and TXT.

The script is the following:

#!/bin/sh
#

# PROVIDE: libreoffice
# REQUIRE: LOGIN cleanvar usr
# KEYWORD: shutdown

. /etc/rc.subr

soffice_path="/usr/local/lib/libreoffice/program"
name="soffice"
#soffice_user="svn"
procname="${soffice_path}/oosplash.bin"
rcvar=`set_rcvar`
pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
command_args="-p $pidfile"
command_args="$command_args ${soffice_path}/${name}"
command_args="$command_args '--accept=socket,host=golem,port=8100,tcpNoDelay=1;urp'"
command_args="$command_args --nologo --headless --nofirststartwizard --invisible"
command_args="$command_args --nolockcheck --norestore"
stop_precmd="${name}_prestop"
soffice_prestop(){
    # kill first child process
    pkill -P `cat $pidfile`
}


load_rc_config $name
run_rc_command "$1"


This script works nicely, and starts libreoffice as a root daemon. But
I need to start it as another user (svn), thus I comment out the line

#soffice_user="svn"

After that, something weird happens with then internal expasion in rc
functions, and I get:

# service soffice restart
Starting soffice.
Syntax error: Unterminated quoted string
eval: urp --nologo --headless --nofirststartwizard --invisible --nolockcheck --norestore": not found
/usr/local/etc/rc.d/soffice: WARNING: failed to start soffice

I am unable to fix this... I am trying escaping quotes, using
backslashes, etc.

Any advice will be wellcome.

Best regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20120325/5941d04e/attachment.pgp


More information about the freebsd-questions mailing list