Skip to content

Instantly share code, notes, and snippets.

@golgote
Created August 1, 2013 11:17
Show Gist options
  • Save golgote/6130472 to your computer and use it in GitHub Desktop.
Save golgote/6130472 to your computer and use it in GitHub Desktop.
Old init script for openoffice daemon, with umask
#!/bin/sh
# Startup script for soffice
#
# chkconfig: 2345 75 35
# description: Run soffice in server mode
# Source function library.
. /etc/rc.d/init.d/functions
SOFFICE=/opt/openoffice.org2.4/program/soffice
[ -f $SOFFICE ] || exit 0
prog="soffice"
LOCKFILE=/var/lock/subsys/$prog
USER=apache
unset DISPLAY
start() {
umask 2
echo -n $"Starting $prog: "
runuser -s /bin/bash -c "$SOFFICE '-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager' -norestore -nofirststartwizard -nologo -headless" $USER &
# daemon --user $USER $SOFFICE "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" -norestore -nofirststartwizard -nologo -headless &
RETVAL=$?
touch $LOCKFILE
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killall -u $USER -q soffice
echo
RETVAL=$?
rm -f $LOCKFILE
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status soffice
;;
restart)
stop
start
;;
condrestart)
if [ -f $LOCKFILE ]; then
stop
start
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment