Skip to content

Instantly share code, notes, and snippets.

@stuzart
Last active October 15, 2020 16:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save stuzart/3787679 to your computer and use it in GitHub Desktop.
Save stuzart/3787679 to your computer and use it in GitHub Desktop.
init.d script for stopping and starting the soffice service
#!/bin/bash
# originally from: http://code.google.com/p/openmeetings/wiki/OpenOfficeConverter
# openoffice.org headless server script
#
# description: headless openoffice server script
# processname: openoffice
#
# Author: Vic Vijayakumar
# Modified by Federico Ch. Tomasczik
# Modified by Stuart Owen
#
OOo_HOME=/usr/bin
SOFFICE_PATH=$OOo_HOME/soffice
set -e
start_soffice(){
echo "Starting OpenOffice headless server"
sudo -H -u www-data $SOFFICE_PATH --headless --nologo --nofirststartwizard --accept="socket,host=127.0.0.1,port=8100;urp" & > /dev/null 2>&1
}
stop_soffice(){
echo "Stopping OpenOffice headless server."
killall -9 soffice.bin
}
COMMAND="$1"
shift
case $COMMAND in
status)
;;
start|stop|restart)
$ECHO
if [ "$COMMAND" = "stop" ]; then
stop_soffice
elif [ "$COMMAND" = "start" ]; then
start_soffice
elif [ "$COMMAND" = "restart" ]; then
stop_soffice
sleep 1s
start_soffice
exit 0
fi
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment