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

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.
Post Reply
okmuser
Expert Boarder
Expert Boarder
Posts: 123
Joined: Fri Dec 16, 2011 1:25 pm

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

Post by okmuser » Mon Feb 27, 2012 6:58 am

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.

pavila
Moderator
Moderator
Posts: 3086
Joined: Tue Dec 11, 2007 6:02 pm
Location: Alicante, Spain
Contact:

Re: Autostart OpenKM on boot - FreeBSD 9.0 RELEASE - 2012/02

Post by pavila » Wed Feb 29, 2012 11:02 pm

In recent OpenKM versions you don't need to start OpenOffice by yourself because this is handle automatically by OpenKM.

okmuser
Expert Boarder
Expert Boarder
Posts: 123
Joined: Fri Dec 16, 2011 1:25 pm

Re: Autostart OpenKM on boot - FreeBSD 9.0 RELEASE - 2012/07

Post by okmuser » Tue Jul 03, 2012 1:41 am

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"

jllort
Moderator
Moderator
Posts: 10929
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Autostart OpenKM on boot - FreeBSD 9.0 RELEASE - 2012/02

Post by jllort » Wed Jul 04, 2012 6:19 pm

I have added in our wiki with a link to this forum post.

Post Reply