How to proper write an upstart script?

65 views Asked by At

I am trying to write an upstart script to be put in /etc/init to start neo4j on start-up. I am on a VM with Ubuntu 16.04. My file, taken from here is named neo4j1.conf and looks like:

description "neo4j1 upstart"

start on local-filesystems
stop on shutdown

script
  echo $$ > /var/run/neo4j1_start.pid
  exec /home/myusr/neo4j/bin/neo4j console
end script

pre-start script
  echo "[`date`] Neo4j  Starting" >> /var/log/neo4j1.log
end script

pre-stop script
  rm /var/run/neo4j1_start.pid
  echo "[`date`] Neo4j Stopping" >> /var/log/neo4j1.log
end script

However it is not working, i.e., when rebooting the service is not active and there is no process.

I tried to remove >> /var/log/neo4j2.log as suggested in other link, I tried to comment the creation and deletion of neo4j1_start.pid because of permissions but it did not work.

How can I create a proper script?

0

There are 0 answers