-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
INSTALLPATH='<%= node[:netkernel][:install_path] %>' | ||
NK_USER='<%= node[:netkernel][:user] %>' | ||
BACKENDPORT="<%= node[:netkernel][:backend][:port] %>" | ||
LOG_DIR="<%= node[:netkernel][:log_path] %>" | ||
|
||
LIB="$INSTALLPATH/lib" | ||
EXT="$INSTALLPATH/lib/ext" | ||
PROPS="-Djava.endorsed.dirs=$LIB/endorsed -Djava.protocol.handler.pkgs=org.ten60.netkernel.protocolhandler -Djava.awt.headless=false" | ||
SUN_PROPS="-Dsun.net.client.defaultConnectTimeout=20000 -Dsun.net.client.defaultReadTimeout=20000" | ||
PID="-Dten60.pid=1" #Process id must be set when using 'netkernel' daemon | ||
STOP_CMD="http://localhost:$BACKENDPORT/tools/shutdown?action2=force" | ||
POLLURL="http://localhost:$BACKENDPORT" | ||
|
||
read BOOTLOADER_JAR < "$INSTALLPATH/bin/bootjar.cnf" || true | ||
read JVMSETTINGS < "$INSTALLPATH/bin/jvmsettings.cnf" || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# SYSV init script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# netkernel | ||
# | ||
# cron is a standard UNIX program that runs user-specified programs at | ||
# periodic scheduled times | ||
|
||
description "NetKernel Application Engine" | ||
|
||
start on runlevel [2345] | ||
stop on runlevel [!2345] | ||
|
||
respawn | ||
|
||
env DEFAULTFILE=/etc/default/netkernel | ||
kill timeout 60 | ||
|
||
pre-start script | ||
. "$DEFAULTFILE" | ||
chown -R $NK_USER $INSTALLPATH || true | ||
chown -R $NK_USER $LOG_DIR || true | ||
end script | ||
|
||
script | ||
. "$DEFAULTFILE" | ||
sudo -u $NK_USER java $JVMSETTINGS $PROP $SUN_PROPS $PID -cp "$BOOTLOADER_JAR" BootLoader "$INSTALLPATH" 2>&1 >/tmp/nk | ||
end script | ||
|
||
post-start script | ||
. "$DEFAULTFILE" | ||
local starttime=`date +"%s"` | ||
while ! wget --tries=1 --timeout=1 --server-response -O - "$POLLURL" 2>&1 | grep -qai " HTTP/1.1 " ; do | ||
sleep 3 | ||
local now=`date +"%s"` | ||
if [ $(($now - 50)) -gt $starttime ]; then | ||
logger $0 "NK did not start in time (50 seconds)... exiting..." | ||
stop | ||
exit 0 | ||
fi | ||
done | ||
end script |