CentOS7配置nexus开机自启动

CentOS7配置nexus开机自启动

新建nexus启动脚本

进入/etc/init.d目录,新建脚本文件nexus

// 进入/etc/init.d
[[email protected]_maven etc]# cd /etc/init.d/

// 新建脚本文件nexus
[[email protected]_maven init.d]# vim nexus

脚本内容:

#!/bin/bash
#chkconfig:2345 20 90
#description:nexus
#processname:nexus

export JAVA_HOME=/root/apps/jdk1.8/

case $1 in
        start) su root /usr/local/nexus3.21/bin/nexus start;;
        stop) su root /usr/local/nexus3.21/bin/nexus stop;;
        status) su root /usr/local/nexus3.21/bin/nexus status;;
        restart) su root /usr/local/nexus3.21/bin/nexus restart;;
        dump) su root /usr/local/nexus3.21/bin/nexus dump;;
        console) su root /usr/local/nexus3.21/bin/nexus console;;
        *) echo "Usage: nexus {start|stop|run|run-redirect|status|restart|force-reload}"
esac

设置脚本权限

[[email protected]_maven init.d]# chmod +x /etc/init.d/nexus

使用service命令使用nexus

[[email protected]_maven init.d]# service nexus status
WARNING: ************************************************************
WARNING: Detected execution as "root" user.  This is NOT recommended!
WARNING: ************************************************************
nexus is running.

添加到开机启动

[[email protected]_maven init.d]# chkconfig nexus on

查看nexus开机启动

[[email protected]_maven ~]# chkconfig --list nexus

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use ‘systemctl list-unit-files‘.
      To see services enabled on particular target use
      ‘systemctl list-dependencies [target]‘.

nexus           0:off   1:off   2:on    3:on    4:on    5:on    6:off

设置防火墙

// 进入防火墙设置文件目录
[[email protected]_maven init.d]# cd /etc/firewalld/zones/
// 使用vim, 修改防火墙配置文件
[[email protected]_maven zones]# vim public.xml

添加以下放开端口内容, 其它不变

  <rule family="ipv4">
  <!-- 开放8081端口给任意ip  -->
  <port protocol="tcp" port="8081"/>
  <accept/>
  </rule>


参考来源

【Nexus】--设置开机自启动

Centos7 firewall防火墙常用配置

原文地址:https://www.cnblogs.com/vitoboy/p/12657581.html

时间: 2024-08-08 13:23:38

CentOS7配置nexus开机自启动的相关文章

Centos7配置BIND开机自启动

Centos7上面已经把/etc/init.d/服务的启动方式更改为systemctl启动. 当然编译安装仍然可以/etc/init.d/手动启动但是chkconfig –add named就用不了. [环境]:CentOS Linux release 7.5.1804 (Core) [BIND]:安装位置/mnt/sscp/data/named/ 1.首先你要编译安装BIND服务并保证服务可以正常运行. CentOS 7的服务systemctlf服务脚本有系统(system)和用户(user)

nexus 开机自启动

一.创建shell服务脚本 创建脚本nexus,并将脚本文件放在/etc/init.d 服务启动目录 #!/bin/bash #chkconfig:2345 20 90 #description:nexus #processname:nexus export NEXUS_HOME=/opt/nexus/nexus-3.6/ case $1 in start) su root $NEXUS_HOME/bin/nexus start;; stop) su root $NEXUS_HOME/bin/n

linux下配置tomcat开机自启动

Linux下配置tomcat开机自启动 1.写一个tomcat脚本,内容如下,设置其权限为755,放在/etc/init.d/目录下 #!/bin/bash## /etc/init.d/tomcat# init script for tomcat precesses## processname: tomcat# chkconfig: 2345 86 16# description: Start up the Tomcat servlet engine. if [ -f /etc/init.d/f

用DOS命令配置服务开机自启动

2016-08-19 15:01 Create 使用命令  sc  config 描述: 在注册表和服务数据库中修改服务项.用法: sc <server> config [service name] <option1> <option2>... 选项:注意: 选项名称包括等号. 等号和值之间需要一个空格.这点尤其重要 type= <own|share|interact|kernel|filesys|rec|adapt> start= <boot|sys

linux 环境NTP配置与开机自启动(转)

Linux下配置NTP服务器一.前言:    默认NTP服务端口:    UDP/123    本文配置的NTP工作模式:    使用client/server方式,该方式适用于一台时间服务器接收上层时间服务器的时间信息,并提供时间信息给下层用户.二.配置方法:1.ntp服务安装NTP服务在RHEL5.x中式默认安装的软件包,可用rpm -qa |grep ntp检查是否安装,如果未安装可使用如下命令安装与删除NTP服务器软件包 #使用rpm方式安装rpm -ivh ntp-4.2.2p1-8.

linux 配置nginx 开机自启动

第一步 首先,在linux系统的/etc/init.d/目录下创建nginx文件,使用如下命令: vi /etc/init.d/nginx nginx 脚本内容: #!/bin/sh # # nginx - this script starts and stops the nginx daemon # # chkconfig: - 85 15 # description: NGINX is an HTTP(S) server, HTTP(S) reverse # proxy and IMAP/P

Centos7 redis设置开机自启动

配置redis 1.设置redis.conf中daemonize为yes,requirepass为你的redis密码,bind注释掉禁用本机访问绑定,确保守护进程开启,也就是在后台可以运行. vi /opt/redis/redis.conf 2.复制redis配置文件(启动脚本需要用到配置文件内容,所以要复制) mkdir /etc/redis cp /usr/local/redis/redis.conf /etc/redis/6379.conf 3.设置redis.conf中daemonize

CentOS7配置Tomcat8开机自动启动

1.创建文件 # vi /etc/systemd/system/tomcat.service [Unit] Description=Tomcat8540 After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=oneshot ExecStart=/usr/local/apache-tomcat-8.5.40/bin/startup.sh ExecStop=/usr/local/apa

centos7.x设置开机自启动

以nginx为例: 假设已经编译安装nginx服务,并将启动脚本存放在/etc/init.d下,以nginx为名,并修改为可执行权限. [[email protected] ~]#  cd /lib/systemd/system/ [[email protected] system]# vim nginx.service [Unit] Description=nginx After=network.target [Service] Type=forking ExecStart=/etc/init