2

I'm trying to configuring BaseX to run as a service on my server. The basexserver command has a flag -S whose functionality is listed as "start as service".

If I run basexserver -S at the command line, it outputs Server was started. and returns to the shell prompt, with the server running as a background process. If I then run basexserver stop, it outputs Server was stopped. and returns to the shell prompt, with the server process no longer running.

Now I want to make this into an upstart job (something which is new to me). I'm not clear on how to translate this start-and-stop interface into an upstart job, particularly with respect to the expect stanza. The Upstart Cookbook recommends a procedure for establishing the fork count of an application; this yielded the number 34, which is well outside the range of expected results. What's the best way to handle this?

1 Answer 1

0

basexserver is a bash script. Instead of calling provided bash script you should translate it to Upstart job. The article EVENTING UPSTART will give you good ideas how to do it.

I would start crafting Upstart job with a simple Upstart stanza exec java -cp BaseX.jar org.basex.BaseXServer. See Starting java processes with Upstart for more details.

2
  • Are you saying the upstart job can't use basexserver to start and stop the process? Other upstart jobs that I've looked at seem to do it that way when such a script exists.
    – Taymon
    Jul 11, 2013 at 15:19
  • Which process is controlling basex? bash (basexserver) of Java (one started by bash script)? basexserver will start Java process which would continue running as daemon. At that point Upstarts louse control over Java process. I digged a bit and found basexserver script in launchpad: bazaar.launchpad.net/~ubuntu-branches/ubuntu/saucy/basex/saucy/… I seriously doubt that Upstart can controll that script. I am assuming that you installed basex from the Ubuntu repository. Jul 11, 2013 at 16:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .