Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Mar 2012 20:22:39 +0200
From:      Jose Garcia Juanino <jjuanino@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Libreoffice daemon in rc script does not work (shell expansion problem)
Message-ID:  <20120325182238.GA25193@banach>

next in thread | raw e-mail | index | archive | help

--d6Gm4EdcadzBjdND
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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

--d6Gm4EdcadzBjdND
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iEYEARECAAYFAk9vYm4ACgkQFOo0zaS9RnJfrwCfQva5RNANuXk+DrWlyFOfLX3o
C7MAn3KjEJzim+6/cN7GfZ00iuhEj2H9
=GSmd
-----END PGP SIGNATURE-----

--d6Gm4EdcadzBjdND--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120325182238.GA25193>