You are not logged in.
Pages: 1
Hi
I have installed openmeetings.
I would like to start LibreOffice as a Daemon as openmeetings needs it when uploading files.
I wrote this deamon ( tried to... )
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
PID=$(pidof -o %PPID /usr/bin/soffice)
case "$1" in
start)
stat_busy "Starting Net LibreOffice Daemon"
[ -z "$PID" ] && /usr/bin/soffice --headless --nologo --nofirststartwizard --accept="socket,host=localhost,port=8100;urp;StarOffice.service" &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon ooffice-net
stat_done
fi
;;
stop)
stat_busy "Stopping Net LibreOffice Daemon"
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon ooffice-net
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0
What happens is that starting it, the daemon is stuck at "Busy".
As you can see most of the code is a copy&paste of existing daemons...
What did I do wrong?
Thanks for your help
Serge
Offline
Offline
Hi Stebalien
With this change, it is still stuck at [busy].
For the second point, how can I make it run as nobody ?
Thank you
Serge
[EDIT]
Actually it "works" when changing to > /dev/null &.
But when stopping the daemon, it fails, when starting again the daemon [not restarting] I always get [done],
when retarting the daemon I get [fail] for stopping the daemon, and [done] for starting the daemon.
It seems that the daemon is never started...
Last edited by csergec (2011-12-27 08:57:22)
Offline
/usr/bin/soffice is a symlink. You need to get the pid of /usr/lib/libreoffice/program/soffice.bin.
$ ls -l /usr/bin/soffice
lrwxrwxrwx 1 root root 36 Dec 19 05:11 /usr/bin/soffice -> /usr/lib/libreoffice/program/soffice*
Next time. If you want to know if a program is running, run
ps -eF|grep '<program>'
Offline
Hi Stebalien
Thank you, it is working.
However, if I start the daemon, it works. If i start it again ( not restart ), I do not get the message telling me the deamon is already running but the [done] message.
I checked with ps, the first pid is running and no new one is starting. So i can live with it.
Stopping and restarting the daemon work too.
Serge
Last edited by csergec (2011-12-27 19:11:50)
Offline
Pages: 1