• Autostart OpenKM on boot - FreeBSD 9.0 RELEASE - 2012/02/28

  • Problems with installing OpenKM? No problemo, the solution is closer than you think.
Problems with installing OpenKM? No problemo, the solution is closer than you think.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #14169  by okmuser
 
Hi Just thought of share the script I used for autostart OpenKM at boot in FreeBSD 9.0 RELEASE.

This is my /usr/local/etc/rc.d/openkm.sh
Code: Select all
#!/bin/sh
#
#
#

# PROVIDE: openkm
# KEYWORD: shutdown

#
# Add the following line to /etc/rc.conf to enable openkm:
#
# openkm_enable="YES"
#

. /etc/rc.subr

name=openkm
rcvar=`set_rcvar`

start_cmd="${name}_start"
stop_cmd="${name}_stop"

openkm_start()
{
	echo "Starting OpenKM...."
                 /home/okmuser/jboss/bin/run.sh -b 0.0.0.0 &

}

openkm_stop()
{
	echo "Shutting down OpenKM...."
                 /home/okmuser/jboss/bin/shutdown.sh -S

}

# set defaults

openkm_enable=${openkm_enable:-"NO"}

load_rc_config ${name}

JAVA_HOME="/usr/local/linux-sun-jdk1.6.0/";

export JAVA_HOME

run_rc_command "$1"
and add the following to /etc/rc.conf
Code: Select all
openkm_enable="YES"
For some reason openkm in FreeBSD doesn't start libreoffice at startup so at the moment I start soffice manually.

/usr/local/etc/rc.d/soffice.sh
Code: Select all
#!/bin/sh
#
#
#

# PROVIDE: soffice
# KEYWORD: shutdown

#
# Add the following line to /etc/rc.conf to enable soffice:
#
# soffice_enable="YES"
#

. /etc/rc.subr

name=soffice
rcvar=`set_rcvar`

command="/usr/local/lib/libreoffice/program/soffice[b]x[/b].sh"
# set defaults

soffice_enable=${soffice_enable:-"YES"}

load_rc_config ${name}

run_rc_command "$1"
and add the following to /etc/rc.conf
Code: Select all
soffice_enable="YES"
and create a sofficex file in /usr/local/lib/libreoffice/program/ with
Code: Select all
#!/bin/sh
#
/usr/local/lib/libreoffice/program/soffice "-accept=socket,host=127.0.0.1,port=2222,tcpNoDelay=1;urp;" -headless -nodefault 
-nofirststartwizard -nolockcheck -nologo -norestore &
please note the above code (/usr/local...... -norestore &) is on single line.

I haven't tried with soffice_flags for soffice, I will check and post if sucessful.

Hope this helps someone.

Cheers,

EDIT: last edited to improve OpenKM starting and shutting down process and modify Java to Sun Java as with OpenJDK I had some issues in properly starting OpenKM.war.
 #17086  by okmuser
 
Updated for better shutdown process:
Code: Select all
#!/bin/sh
# Openkm startup Script

# PROVIDE: Openkm
# REQUIRE: mysql LOGIN
# KEYWORD: shutdown

. /etc/rc.subr

name="Openkm"
rcvar=${name}_enable
Openkm_enable=${Openkm_enable-"NO"}

start_cmd="${name}_start"
stop_cmd="${name}_stop"

load_rc_config $name

JAVA_HOME="/usr/local/openjdk6/";

export JAVA_HOME

procname="java"

Openkm_start(){
echo "Starting OpenKM....."
rm -r /alldata/programs/jboss/server/default/work &
rm -r /alldata/programs/jboss/server/default/tmp &
/usr/local/lib/libreoffice/program/soffice "--accept=socket,host=localhost,port=2222;urp;StarOffice.ServiceManager" --nologo --headless --nofirststartwizard &
su -m nobody -c /alldata/programs/jboss/bin/run.sh -b 0.0.0.0 & > /dev/null

}

Openkm_stop(){

echo "Stopping OpenKM....."
/alldata/programs/jboss/bin/shutdown.sh -S
killall -9 soffice.bin &
}


run_rc_command "$1"

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.