bcaf
![]() |
|
|
|
|
|||||||
| Userland Programming & Scripting C, Shell, Perl, Sed & Awk |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I have recently migrated from Debian Wheezy to FreeBSD 9.0 Release. One of the programs I use is OpenKM which is a jboss based document management system. I was able to create an rc.d script to start this program on system startup and close the program on system shutdown. Startup works fine as there is no time limit on how long the program can take to start. But on shutdown the program couldn't close properly as the system shutdown is too fast. I have included Code:
# PROVIDES: Sopenkm java # KEYWORD: shutdown Is there anything more I need to do to give the program enough time to close properly before the system shutdown? Thanks heaps, Last edited by phoenix; July 27th, 2012 at 07:11. Reason: spelling nits |
|
#2
|
|||
|
|||
|
Complete : script
Code:
#!/bin/sh
# Sopenkm startup Script
# PROVIDE: Sopenkm java
# KEYWORD: shutdown
. /etc/rc.subr
name="Sopenkm"
rcvar=${name}_enable
Sopenkm_enable=${Sopenkm_enable-"NO"}
start_cmd="${name}_start"
stop_cmd="${name}_stop"
load_rc_config $name
JAVA_HOME="/usr/local/openjdk6/";
export JAVA_HOME
Sopenkm_start(){
echo "Starting OpenKM....."
rm -r /mydata/jboss/server/default/work & rm -r /mydata/jboss/server/default/tmp & /usr/local/lib/libreoffice/program/soffice "-accept=socket,host=localhost,port=2222;urp;StarOffice.ServiceManager" -nologo -headless -nofirststartwizard & /mydata/jboss/bin/run.sh -b 0.0.0.0 &
}
Sopenkm_stop(){
echo "Stopping OpenKM....."
/mydata/jboss/bin/shutdown.sh -S
killall -9 soffice.bin &
}
run_rc_command "$1"
Last edited by DutchDaemon; March 29th, 2012 at 00:19. |
|
#3
|
|||
|
|||
|
I think that doing
killall -9 soffice.bin & can be the issue. You are sending a SIGKILL to the processes and detaching, so that the rest of shutdown goes on. I'm not sure if I understand it correctly, but if you use SIGKILL, it will not be given a chance to shutdown properly (if shutdown.sh didn't finish). Use a SIGTERM instead (if the software can catch it and perform a clean shutdown by itself). If I'm wrong, somebody please correct me. Last edited by DutchDaemon; April 1st, 2012 at 20:37. Reason: Proper formatting: http://forums.freebsd.org/showthread.php?t=8816 |
|
#4
|
|||
|
|||
|
The reason the script didn't shutdown properly was the java process is the one which actually started by the script not Openkm.
So adding Code:
procname="java" My new script looks like this: Code:
#!/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"
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ZFS: nfs mountd 100% CPU for very long time | Leroy_van_Logchem | Storage | 1 | February 23rd, 2012 15:05 |
| [Solved] yet another crontab question - what about program that takes long time? | ivand58 | General | 4 | July 31st, 2011 01:18 |
| [Solved] Installing KDE, taking a LONG time | sysop1911 | Installation and Maintenance of FreeBSD Ports or Packages | 5 | July 27th, 2011 19:05 |
| [Solved] why so long time needed? | pkhtut | Installing & Upgrading | 12 | October 22nd, 2009 08:18 |
| sshd take long time to start | mfaridi | Web & Network Services | 4 | April 26th, 2009 19:05 |