NicoCache_nlの設定

javaservicewapperでNicoCache_nlをサービスとして動かす。以前にも書いた内容をまとめる。NicoCache_nl wikiのインストールとアップデートを参考に最新版を入手する。

/usr/local/lib/javaservicewrapper/bin以下へ入手したファイルを全てコピーする。いらないファイルもコピーするのは横着しています。

# ls /usr/local/lib/javaservicewrapper/bin/

NicoCacheGUI-debug.bat*         extensions/
NicoCacheGUI.bat*               local/
NicoCacheGUI.jar*               nlFilter_sys.txt*
NicoCache_nl.bat*               nlFilters/
NicoCache_nl.jar                nlFilter解説.txt*
NicoCache_nl.sh*                proxy_sample.pac*
Readme.txt*                     readmeGUI_fix20090510.txt*
Readme_nl.txt*                  readme_swfConvert.txt
Readme_nl_beta2.txt*            testwrapper*
cache/                          wrapper*
cacheComment.txt*               サンプルフィルタ/
config.properties*              設定サンプル.txt*

NicoCache_nl.shの内容

同じフォルダにあるtestwarperをNicoCache_nl.shとcopy & renameした。必要なところだけを変更したつもりです。先頭のexportはrc.localから実行すると必要になるため設定しています。
以前と異なるのは、jdk16が不要となったことだ。

#! /bin/sh

export JAVA_HOME=/usr/local/diablo-jdk1.6.0
export PATH=$PATH:$JAVA_HOME/bin
export LANG="ja_JP.UTF-8"

#
# Copyright (c) 1999, 2006 Tanuki Software Inc.
#
# Java Service Wrapper sh script.  Suitable for starting and stopping
#  wrapped Java applications on UNIX platforms.
#

#-----------------------------------------------------------------------------
# These settings can be modified to fit the needs of your application

# Application
APP_NAME="NicoCache_nl"
APP_LONG_NAME="NicoNico chache Application"

# Wrapper
WRAPPER_CMD="/usr/local/lib/javaservicewrapper/bin/wrapper"
WRAPPER_CONF="/usr/local/lib/javaservicewrapper/conf/nico.conf"

# Priority at which to run the wrapper.  See "man nice" for valid priorities.
#  nice is only used if a priority is specified.
PRIORITY=

# Location of the pid file.
PIDDIR="/var/run"

# If uncommented, causes the Wrapper to be shutdown using an anchor file.
#  When launched with the 'start' command, it will also ignore all INT and
#  TERM signals.
#IGNORE_SIGNALS=true

# If specified, the Wrapper will be run as the specified user.
# IMPORTANT - Make sure that the user has the required privileges to write
#  the PID file and wrapper.log files.  Failure to be able to write the log
#  file will cause the Wrapper to exit without any way to write out an error
#  message.
# NOTE - This will set the user which is used to run the Wrapper as well as
#  the JVM and is not useful in situations where a privileged resource or
#  port needs to be allocated prior to the user being changed.
#RUN_AS_USER=

# The following two lines are used by the chkconfig command. Change as is
#  appropriate for your application.  They should remain commented.
# chkconfig: 2345 20 80
# description: Test Wrapper Sample Application

# Do not modify anything beyond this point
(以降は変更していません)

nico.confの内容

/usr/local/lib/javaservicewrapper/conf/wrapper.confをnico.confへcopy & renameした。必要なところだけを変更したつもりです。

#********************************************************************
# TestWrapper Properties
#
# NOTE - Please use src/conf/wrapper.conf.in as a template for your
#        own application rather than the values used for the
#        TestWrapper sample.
#********************************************************************
# Java Application
wrapper.java.command=java

# Java Main class.  This class must implement the WrapperListener interface
#  or guarantee that the WrapperManager class is initialized.  Helper
#  classes are provided to do this for you.  See the Integration section
#  of the documentation for details.
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

# Java Classpath (include wrapper.jar)  Add class path elements as
#  needed starting from 1
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.2=NicoCache_nl.jar
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=../lib

# Java Additional Parameters
#wrapper.java.additional.1=

# Initial Java Heap Size (in MB)
#wrapper.java.initmemory=3

# Maximum Java Heap Size (in MB)
#wrapper.java.maxmemory=64

# Application parameters.  Add parameters as needed starting from 1
wrapper.app.parameter.1=dareka.Main

#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Format of output for the console.  (See docs for formats)
wrapper.console.format=PM

# Log Level for console output.  (See docs for log levels)
wrapper.console.loglevel=INFO

# Log file to use for wrapper output logging.
wrapper.logfile=/var/log/nico.log

# Format of output for the log file.  (See docs for formats)
wrapper.logfile.format=LPTM

# Log Level for log file output.  (See docs for log levels)
wrapper.logfile.loglevel=INFO

# Maximum size that the log file will be allowed to grow to before
#  the log is rolled. Size is specified in bytes.  The default value
#  of 0, disables log rolling.  May abbreviate with the 'k' (kb) or
#  'm' (mb) suffix.  For example: 10m = 10 megabytes.
wrapper.logfile.maxsize=100k

# Maximum number of rolled log files which will be allowed before old
#  files are deleted.  The default value of 0 implies no limit.
wrapper.logfile.maxfiles=1

# Log Level for sys/event log output.  (See docs for log levels)
wrapper.syslog.loglevel=NONE

#********************************************************************
# Wrapper Windows Properties
#********************************************************************
# Title to use when running as a console
wrapper.console.title=Test Wrapper Sample Application

#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
#  using this configuration file has been installed as a service.
#  Please uninstall the service before modifying this section.  The
#  service can then be reinstalled.

# Name of the service
wrapper.ntservice.name=testwrapper

# Display name of the service
wrapper.ntservice.displayname=Test Wrapper Sample Application

# Description of the service
wrapper.ntservice.description=Test Wrapper Sample Application Description

# Service dependencies.  Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=

# Mode in which the service is installed.  AUTO_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START

# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false

あと、config.propertiesは

# 接続元の限定
#       lanC    プライベートIP(192.168.xxx.xxx) ←普通これ
allowFrom=lanC

とする程度に違いはない。

電源ONで起動させるため/etc/rc.localに

/usr/local/lib/javaservicewrapper/bin/NicoCache_nl.sh start

を記述した。
/usr/local/etc/rc.d以下に置いても、起動してくれないのでしかたがなくだ。