3

Is there an easy method of starting Fuseki when the OS starts, more or less like we can start a Tomcat or ElasticSearch instance from /etc/init.d/tomcat7 start or /etc/init.d/elasticsearch start?

As far as I have seen Fuseki doesn't seem to have a status method, and also it doesn't seem to have something similar to this /etc/init.d/ trick.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
paxRoman
  • 2,064
  • 3
  • 19
  • 32
  • I just downloaded jena-fuseki, and there are two important files in it: `fuseki` and `fuseki-server`. Running `fuseki`, I get the output `Usage: fuseki {start|stop|restart|status}`. Is `fuseki status` the sort of usage you're looking for? – Joshua Taylor Oct 27 '14 at 14:01
  • Hi @JoshuaTaylor! Yes that seems to be it. Thanks again! I had an older version of Fuseki that doesn't seem to have this kind of behavior, or at least it's missing this file.... Maybe I corrupted it somehow. Anyway, let me test, and I will accept the answer in few minutes. Best regards! – paxRoman Oct 27 '14 at 14:18

1 Answers1

7

Actually, Fuseki comes with a script that does exactly the kinds of things you're asking for. It's just a matter of putting the fuseki script in an init.d directory, I think. The fuseki script that comes in the distribution takes a {start|stop|restart|status} argument. Here's what it looks like in use from the command line:

$ ./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

It's actually designed for this purpose; looking at the source we see:

# 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
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • I will have to test this first. @JoshuaTaylor – paxRoman Oct 27 '14 at 14:18
  • Yes. It is working. There was however something in my configuration that caused some problems apparently. Might return with a different question when I discover what's causing the current problem. Thanks again! @JoshuaTaylor – paxRoman Oct 27 '14 at 14:24
  • Could I please ask where you would recommend to put jena and fuseki? I currently have them just in my home folder but I see some guides around the web that put them in /usr/lib and other places. But just to get the server sorted out properly where would you think is the right place to put them. Thanks.. – Vida Mar 03 '15 at 14:31
  • @vida i think that's OS/distribution dependent. Where does your distribution put similar software, e.g., database servers? – Joshua Taylor Mar 03 '15 at 21:02
  • Heh, to be honest I'm not that knowledgeable about *nix. I'd be using a Ubuntu 14.04 server. So, yeah, I'll go ask some people about where the other software would go. Thanks. – Vida Mar 04 '15 at 09:54