Search code examples
javaubuntusolrinitupstart

upstart start job with delay after another job was started and is running


I'm trying to use upstart for the first time. I have two java programs that i want to start. The first one is a solr search server running on jetty, and the second one is a custom crawler that should start after the solr server started.

my crawler init script looks like this:

description     "crawler"
author ""

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

respawn

script
    cd /home/crawler
    java -Duser.timezone=Europe/Berlin  -jar crawler.jar
end script

Now for the solr server i wrote this:

description     "server"

start on starting crawler
stop on runlevel [!2345]

respawn

script
    cd /home/server/version0.1/example
    java -Duser.language=en -Dsolr.clustering.enabled=true -Duser.country=US  -Dfile.encoding=UTF-8 -jar start.jar
end script

both get started so it seems to work, but i want the crawler to be started after a little delay of say 2 seconds, to give the server time to enable everything. Anyone knows how to do this? What do you think about the two upstart scripts are they okay or did i miss something? (I'm a total init noob)


Solution

  • Replace starting with started

    start on started crawler