The Linux program is set to run the service

    In linux, the program settings systemctl services and start-up. With nexus services, for example: to enter the usr / lib / systemd / system / directory nexus.service new file, write the following, please field descriptions Field Description Baidu systemctl services.

    With nexus services, for example:

    Enter / usr / lib / systemd / system, the new nexus.service file, write the following, please field descriptions Field Description Baidu systemctl services.

    ……

[Unit]

Description=Nexus

After=network.target remote-fs.target nss-lookup.target

[Service]

Type=forking

Environment="JAVA_HOME=/usr/java/jdk1.8.0_144"

ExecStart=/usr/local/nexus/nexus-3.7.1-02/bin/nexus start

ExecStop=/usr/local/nexus/nexus-3.7.1-02/bin/nexus stop

[Install]

WantedBy=multi-user.target

    Save and exit, enter: systemctl reload * .service # reload service profile. Then you can start the service, systemctl start nexus.service to

    Set boot: systemctl enable nexus.service, systemctl common commands:

    Whether systemctl is-enabled servicename.service # query service boot

    systemctl enable * .service # start running services

    systemctl disable * .service # canceled switched on

    systemctl start * .service # Start Service

    systemctl stop * .service # out of service

    systemctl restart * .service # restart the service

    systemctl reload * .service # reload service profile

    systemctl status * .service # query service running status

    systemctl --failed # show service failed to start

Guess you like

Origin www.cnblogs.com/dengshuangjang/p/11786010.html