How to create custom service for Centos 7

Create a script like :

[Unit]

 

Description = FaradCrmService

 

After = network.target

 

[Service]

 

ExecStart = /var/opt/jdk1.8.0_91/bin/java -jar /root/software/fia/farad-1.5.4.RELEASE.jar

 

[Install]

 

WantedBy = multi-user.target

 

Put the script into -> /usr/lib/systemd/system/farad.service

or in /etc/systemd/system/ (change the symbolic link)

create a symbolic link like this : ln -s /usr/lib/systemd/system/farad.service /etc/systemd/system/multi-user.target.wants/farad.service

enable the service : systemctl enable farad.service

start the service : service farad start

if modify the script, reload it with : systemctl daemon-reload

check it status : systemctl status farad.service

Leave a Reply