Cannot start a service that I created

Issues related to applications and software problems
Post Reply
liloulinx
Posts: 21
Joined: 2016/12/05 10:23:43

Cannot start a service that I created

Post by liloulinx » 2018/01/18 21:55:41

Hello,

I have created the service « /etc/systemd/system/My_App_Neo4j.service » with the following content :

Code: Select all

[Unit]
Description=This script start Neo4j at the boot

[Service]
Type=simple
#User=My_App_user
ExecStart=/opt/My_APP/Neo4j/initd.sh start
ExecReload=/opt/My_APP/Neo4j/initd.sh restart
ExecStop=/opt/My_APP/Neo4j/initd.sh stop
TimeoutStartSec=0

[Install]
WantedBy=default.target
I have reloaded the systemctl daemon

Code: Select all

systemctl daemon-reload
I have entered the following commands to activate my service on the boot and start it.

Code: Select all

systemctl enable My_App_Neo4j.service 
systemctl start My_App_Neo4j.service 
No error occured, but the service (or specifically the script) is not really started. When I enter the « systemctl status » command, I get this error « Usage: /opt/MY_App/Neo4j/initd.sh {start|stop...us} » (see bellow):

Code: Select all

[My_App_user@ip-my-machine ~]$ sudo systemctl status My_App_Neo4j.service
● My_App_Neo4j.service - This script start Neo4j at the boot
   Loaded: loaded (/etc/systemd/system/My_App_Neo4j.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2018-01-18 17:45:17 UTC; 13s ago
  Process: 1518 ExecStart=/opt/MY_APP/Neo4j/initd.sh (code=exited, status=2)
Main PID: 1518 (code=exited, status=2)

Jan 18 17:45:17 ip-192-168-0-98.eu-west-1.compute.internal systemd[1]: Started This script start Neo4j at the boot.
Jan 18 17:45:17 ip-192-168-0-98.eu-west-1.compute.internal systemd[1]: Starting This script start Neo4j at the boot...
Jan 18 17:45:17 ip-192-168-0-98.eu-west-1.compute.internal initd.sh[1518]: Usage: /opt/MY_App/Neo4j/initd.sh {start|stop...us}
Jan 18 17:45:17 ip-192-168-0-98.eu-west-1.compute.internal systemd[1]: My_App_Neo4j.service: main process exited, code=exite...ENT
Jan 18 17:45:17 ip-192-168-0-98.eu-west-1.compute.internal systemd[1]: Unit My_App_Neo4j.service entered failed state.
Jan 18 17:45:17 ip-192-168-0-98.eu-west-1.compute.internal systemd[1]: My_App_Neo4j.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
It is to be noted that the script « /opt/My_APP/Neo4j/initd.sh » can receive the start stop and status arguments. When I run it, it gives the expected results.
Eg.

Code: Select all

$ /opt/My_APP/Neo4j/initd.sh status
Neo4j is not running

$ /opt/MY_APP/Neo4j/initd.sh start
Active database: graph.db
Directories in use:
  home:         /opt/MY_APP/Neo4j/neo4j-enterprise-3.2.3
  config:       /opt/MY_APP/Neo4j/neo4j-enterprise-3.2.3/conf
  logs:         /home/airnavx_user/local/logs/neo4j
  plugins:      /opt/MY_APP/Neo4j/neo4j-enterprise-3.2.3/plugins
  import:       /mnt/airnavx/data/cypher
  data:         /home/airnavx_user/local/data
  certificates: /opt/MY_APP/Neo4j/neo4j-enterprise-3.2.3/conf/ssl
  run:          /home/airnavx_user/local/run
Starting Neo4j.
Started neo4j (pid 1749). It is available at http://0.0.0.0:7474/
This HA instance will be operational once it has joined the cluster.
See /home/airnavx_user/local/logs/neo4j/neo4j.log for current status.
0 Neo4j started

$ /opt/MY_APP/Neo4j/initd.sh status
Neo4j is running at pid 1749
Thank you for saying what is wrong or what is missing in my procedure.
Cordially.
Last edited by liloulinx on 2018/01/22 17:35:48, edited 1 time in total.

tunk
Posts: 1206
Joined: 2017/02/22 15:08:17

Re: Cannot start a service that I created

Post by tunk » 2018/01/19 11:23:51

I don't have a clue about neo4j, but you may want to look at this:
- "After=ElasticSearch.target", it may need other services as well
- I think the run environment is different at boot and as an interactive shell, so there may be something in initd.sh

Post Reply