<p dir="auto">I discovered that when we start service neo4j with systemd on ubuntu /etc/systemd/system/neo4j.service is buggy.<br>
I already create a ticket n°7911 on problem with false analysis.</p>
<ul dir="auto">
<li>Neo4j version: 3.0.1 to 3.1.1</li>
<li>Operating system: Ubuntu 16.04 and 16.10</li>
<li>API/Driver: file systemd /etc/systemd/system/neo4j.service</li>
</ul>
<p dir="auto">missing lines in file neo4j.service of systemd for creating folder /run/neo4j  and attribute authorizations to this folder.<br>
...<br>
[Service]:<br>
...<br>
RuntimeDirectory=neo4j<br>
RuntimeDirectoryMode=770<br>
...</p>
<h3 dir="auto">Steps to reproduce**</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="user@hostname:~$ systemctl status neo4j.service 
● neo4j.service - Neo4j Management Service 
  Loaded: loaded (/etc/systemd/system/neo4j.service; enabled; vendor preset: enabled) 
  Active: failed (Result: exit-code) since mar. 2016-08-16 17:33:00 CEST; 2s ago 
 Process: 25319 ExecStop=/usr/bin/neo4j stop (code=exited, status=0/SUCCESS) 
 Process: 21791 ExecStart=/usr/bin/neo4j start (code=exited, status=0/SUCCESS) 
Main PID: 21849 (code=exited, status=143)"><pre class="notranslate"><code class="notranslate">user@hostname:~$ systemctl status neo4j.service 
● neo4j.service - Neo4j Management Service 
  Loaded: loaded (/etc/systemd/system/neo4j.service; enabled; vendor preset: enabled) 
  Active: failed (Result: exit-code) since mar. 2016-08-16 17:33:00 CEST; 2s ago 
 Process: 25319 ExecStop=/usr/bin/neo4j stop (code=exited, status=0/SUCCESS) 
 Process: 21791 ExecStart=/usr/bin/neo4j start (code=exited, status=0/SUCCESS) 
Main PID: 21849 (code=exited, status=143)
</code></pre></div>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">Script /etc/systemd/system/neo4j.service :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[Unit] 
Description=Neo4j Management Service

[Service] 
Type=forking
#User=neo4j
RuntimeDirectory=neo4j
RuntimeDirectoryMode=770
ExecStart=/usr/bin/neo4j start
ExecStop=/usr/bin/neo4j stop
ExecReload=/usr/bin/neo4j restart
RemainAfterExit=no
Restart=on-failure
PIDFile=/var/run/neo4j/neo4j.pid
LimitNOFILE=60000
TimeoutSec=600

[Install]
WantedBy=multi-user.target"><pre class="notranslate"><code class="notranslate">[Unit] 
Description=Neo4j Management Service

[Service] 
Type=forking
#User=neo4j
RuntimeDirectory=neo4j
RuntimeDirectoryMode=770
ExecStart=/usr/bin/neo4j start
ExecStop=/usr/bin/neo4j stop
ExecReload=/usr/bin/neo4j restart
RemainAfterExit=no
Restart=on-failure
PIDFile=/var/run/neo4j/neo4j.pid
LimitNOFILE=60000
TimeoutSec=600

[Install]
WantedBy=multi-user.target
</code></pre></div>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">Script /etc/systemd/system/neo4j.service :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[Unit] 
Description=Neo4j Management Service

[Service] 
Type=forking
#User=neo4j
ExecStart=/usr/bin/neo4j start
ExecStop=/usr/bin/neo4j stop
ExecReload=/usr/bin/neo4j restart
RemainAfterExit=no
Restart=on-failure
PIDFile=/var/run/neo4j/neo4j.pid
LimitNOFILE=60000
TimeoutSec=600

[Install]
WantedBy=multi-user.target"><pre class="notranslate"><code class="notranslate">[Unit] 
Description=Neo4j Management Service

[Service] 
Type=forking
#User=neo4j
ExecStart=/usr/bin/neo4j start
ExecStop=/usr/bin/neo4j stop
ExecReload=/usr/bin/neo4j restart
RemainAfterExit=no
Restart=on-failure
PIDFile=/var/run/neo4j/neo4j.pid
LimitNOFILE=60000
TimeoutSec=600

[Install]
WantedBy=multi-user.target
</code></pre></div>
<p dir="auto">I have noticed that a fresh install of neo4j enterprise is not creating pid file on /var/run/neo4j directory. Also if I'm creating this directory manually it's been deleted by neo4j stop procedure.<br>
The result is an instance of neo4j which is not controllable by neo4j bin file.<br>
This occurs after first reboot of the server and in order to stop neo4j I forced to kill -9 the process.</p>
<p dir="auto"><strong>Neo4j Version:</strong> 3.0M03<br>
<strong>Operating System:</strong> Ubuntu 14.04</p>
<h3 dir="auto">Steps to reproduce</h3>
<ol dir="auto">
<li>apt-get install neo4j-enterprise</li>
<li>reboot the server</li>
<li>check running process - you will notice that neo4j is running by neo4j user</li>
<li>try to stop neo4j by <code class="notranslate">#service neo4j stop / start</code></li>
<li>You will receive: /usr/share/neo4j/bin/neo4j: line 149: /var/run/neo4j/neo4j.pid: No such file or directory</li>
</ol>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">neo4j start procedure should create neo4j.pid file on upstart<br>
neo4j stop procedure should delete neo4j.pid</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">neo4j start procedure is not creating neo4j.pid file on upstart</p>