Create a self-starting service (for Ubuntu and centOS)

Create a self-starting service (for Ubuntu and centOS)

Take creating nexus as an example

1. Create the file /etc/init.d/nexus with the following content

#!/bin/bash
/usr/bin/nexus $*

and save the file;

 

2. Register to startup

Register nexus at boot time (Ubuntu, 32 bit):
sudo ln -s $NEXUS_HOME/bin/nexus /usr/bin/nexus
sudo chmod 755 /etc/init.d/nexus
sudo update-rc.d nexus defaults


Register nexus at boot time (RedHat, CentOS, 64 bit):
sudo ln -s $NEXUS_HOME/bin/nexus /usr/bin/nexus
sudo chmod 755 /etc/init.d/nexus
sudo chkconfig --add nexus

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326679731&siteId=291194637