How can I get my Stardog service to autostart in azure ubuntu VM?

365 views Asked by At

I'm a linux super newbie so let's break it down. I am following these instructions but it still doesn't seem to be working.

My stardog.conf file looks like:

description "stardog database"

start on runlevel [2345]
stop on runlevel [!2345]

umask 077

env STARDOG_UID=azureuser
env STARDOG_GID=1000
env ROOTJAIL=
env STARDOG_LOCATION=/stardog
env STARDOG_HOME=

exec /bin/bash /stardog/sparent

respawn

I've placed this .conf file inside /etc/init like the directions say, I have an schild and sparent file placed in the stardog directory, then I run "sudo start stardog" in the VM. This doesn't seem to work because even when I get a list of all processes (ps -a) stardog or java doesn't appear on the list (it would show up as a java service). When I reboot, stardog is not running.

1

There are 1 answers

0
Al Baker On

For the scripts at https://github.com/snowell/stardog-ubuntu-scripts - make sure to set all of the variables. Did you set STARDOG_HOME? This needs to be the directory where Stardog will store the variables.

If you'd like a more direct script that inspired the source github project, here was one of the very first Ubuntu upstart scripts for Stardog (this was 1.x) and was generalized with the conf file for the above repo.

uparent:

#!/bin/sh

exec &>/tmp/s.out
set -x

mount -t proc proc /opt/tomcat/chroot/proc

#/usr/sbin/chroot --userspec=1005:1005 /opt/tomcat/chroot /opt/test/stardog/uchild
/usr/sbin/chroot --userspec=1005:1005 /opt/tomcat/chroot /opt/stardog/uchild

umount /opt/tomcat/chroot/proc

And the corresponding schlid

#!/bin/sh

export JAVA_HOME=/usr/lib/jvm/java-6-sun
export STARDOG_HOME=/opt/stardog

function shutdownStardog {
 /opt/stardog/stardog-admin server stop
}

trap shutdownStardog HUP INT QUIT ABRT KILL ALRM TERM TSTP

sync; echo 3 > /proc/sys/vm/drop_caches

#/opt/stardog/stardog-admin server start
# Instead we will execute the stardog-cli.jar directly so the wait command will have an infinite process
# to wait for.  Maybe.
java -XX:SoftRefLRUPolicyMSPerMB=1 -XX:+UseParallelOldGC -XX:+UseCompressedOops -server -classpath /opt/stardog/client/cli/stardog-cli.jar com.complexible.stardog.cli.admin.CLI server start >> /opt/stardog/stardog.log 2>&1 &

wait $!