【问题标题】:How to start Fuseki when OS starts?OS启动时如何启动Fuseki?
【发布时间】:2024-04-21 12:20:02
【问题描述】:

有没有一种在操作系统启动时启动 Fuseki 的简单方法,或多或少就像我们可以从 /etc/init.d/tomcat7 start/ 启动 Tomcat 或 ElasticSearch 实例一样etc/init.d/elasticsearch 开始

据我所见,Fuseki 似乎没有 status 方法,而且它似乎也没有类似于 /etc/init.d/ 的东西 诡计。

【问题讨论】:

  • 我刚下载了jena-fuseki,里面有两个重要的文件:fusekifuseki-server。运行fuseki,我得到输出Usage: fuseki {start|stop|restart|status}fuseki status 是您正在寻找的那种用法吗?
  • 嗨@JoshuaTaylor!是的,似乎就是这样。再次感谢!我有一个旧版本的 Fuseki 似乎没有这种行为,或者至少它缺少这个文件......也许我以某种方式损坏了它。无论如何,让我测试一下,我会在几分钟内接受答案。最好的问候!

标签: tomcat elasticsearch sparql jena fuseki


【解决方案1】:

实际上,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

【讨论】:

  • 我必须先测试一下。 @JoshuaTaylor
  • 是的。这是工作。然而,我的配置中有一些东西显然导致了一些问题。当我发现导致当前问题的原因时,可能会返回一个不同的问题。再次感谢! @JoshuaTaylor
  • 请问您建议将jena和fuseki放在哪里?我目前将它们放在我的主文件夹中,但我在网上看到一些指南将它们放在 /usr/lib 和其他地方。但只是为了正确整理服务器,您认为将它们放置在正确的位置。谢谢..
  • @vida 我认为这取决于操作系统/发行版。您的发行版将类似软件(例如数据库服务器)放在哪里?
  • 嘿,老实说,我对 *nix 并不了解。我将使用 Ubuntu 14.04 服务器。所以,是的,我会去问一些人其他软件的去向。谢谢。
最近更新 更多