是否有一种在操作系统启动时启动 Fuseki 的简单方法,或多或少就像我们可以从/etc/init.d/tomcat7 start或/etc/init.d/elasticsearch start启动 Tomcat 或 ElasticSearch 实例一样?
据我所见,Fuseki 似乎没有状态方法,而且它似乎也没有类似于/etc/init.d/技巧的东西。
是否有一种在操作系统启动时启动 Fuseki 的简单方法,或多或少就像我们可以从/etc/init.d/tomcat7 start或/etc/init.d/elasticsearch start启动 Tomcat 或 ElasticSearch 实例一样?
据我所见,Fuseki 似乎没有状态方法,而且它似乎也没有类似于/etc/init.d/技巧的东西。
实际上,Fuseki 附带了一个脚本,它完全可以满足您的要求。我认为这只是将fuseki脚本放在init.d目录中的问题。发行版中的fuseki脚本采用{start|stop|restart|status}参数。这是从命令行使用的样子:
$ ./fuseki
Usage: fuseki {start|stop|restart|status}
$ ./fuseki status
Fuseki is not running
$ ./fuseki start
Starting Fuseki: Redirecting Fuseki stderr/stdout to .../jena-fuseki-1.1.2-SNAPSHOT/log/stderrout.log
STARTED Fuseki Mon Oct 27 10:02:59 EDT 2014
PID=3752
$ ./fuseki status
Fuseki is running with pid: 3752
$ ./fuseki restart
Stopping Fuseki: OK
Starting Fuseki: Redirecting Fuseki stderr/stdout to .../jena-fuseki-1.1.2-SNAPSHOT/log/stderrout.log
STARTED Fuseki Mon Oct 27 10:03:09 EDT 2014
PID=3813
$ ./fuseki status
Fuseki is running with pid: 3813
$ ./fuseki stop
Stopping Fuseki: OK
$ ./fuseki status
Fuseki is not running
它实际上是为此目的而设计的;查看我们看到的来源:
# Startup script for Fuseki under *nix systems (works with cygwin too)
#
# Configuration
# -------------
# Default values are loaded from /etc/default/fuseki, if it exists.
⋮
# FUSEKI_HOME
# Where Fuseki is installed. If not set, the script will try
# to guess it based on the script invokation path.
#
# FUSEKI_RUN
# Where the fuseki.pid file should be stored. It defaults
# first available of /var/run, /usr/var/run, and /tmp if not set.
#
# FUSEKI_PID
# The FUSEKI PID file, defaults to $FUSEKI_RUN/fuseki.pid
#
# FUSEKI_ARGS
# The arguments to pass to the Fuseki server on the command line. Defaults to:
# --update --loc=$FUSKEI_DATA_DIR /ds # if FUSEKI_CONF is not set
# --config=$FUSEKI_CONF # if FUSEKI_CONF is set
#
# FUSEKI_CONF
# The Fuseki configuration file, usually in RDF Turtle notation.
#
# FUSEKI_USER
# If set, the server will be run as this user
#
# FUSEKI_DATA_DIR
# The location of the data directory Fuseki will use (i.e. the value of --loc).
# Defaults to $FUSEKI_HOME/DB
#
# FUSEKI_LOGS
# Directory where logs will be generated. Defaults to $FUSEKI_HOME/log
#
# FUSEKI_LOGS_STDERROUT
# Log file with stderr and stdout log output from Fuseki. Defaults to
# $FUSEKI_LOGS/stderrout.log