zoukankan      html  css  js  c++  java
  • centos开机启动脚本

    nginx开机启动

    cd /lib/systemd/system/
    vim nginx.service

    [Unit]
    Description=nginx service
    After=network.target

    [Service]
    Type=forking
    ExecStart=/usr/local/nginx/sbin/nginx
    ExecReload=/usr/local/nginx/sbin/nginx -s reload
    ExecStop=/usr/local/nginx/sbin/nginx -s quit
    PrivateTmp=true

    [Install]
    WantedBy=multi-user.target

    systemctl enable nginx
    systemctl daemon-reload

    ###########################################

    redis开机启动

    vim /etc/systemd/system/redis-server.service
    1. [Unit]
    2. Description=redis-server
    3. After=network.target
    4. [Service]
    5. Type=forking
    6. ExecStart=/usr/local/redis/bin/redis-server /etc/redis/redis.conf
    7. PrivateTmp=true
    8. [Install]
    9. WantedBy=multi-user.target

    #######################################

    ElasticSearch开机启动

    #!/bin/bash
    #
    #chkconfig: 345 63 37
    #description: elasticsearch
    #processname: elasticsearch-7.4.0

    ES_HOME=/usr/local//usr/local/elasticsearch-7.4.0

    case $1 in
      start)

           su es<<!        【es 这个是启动es的账户,如果你的不是这个记得调整】
           cd $ES_HOME
           ./bin/elasticsearch -d -p pid

        echo "elasticsearch is started"
        ;;
      stop)
        pid=`cat $ES_HOME/pid`
        kill -9 $pid
        echo "elasticsearch is stopped"
        ;;
      restart)
        pid=`cat $ES_HOME/pid`
        kill -9 $pid
        echo "elasticsearch is stopped"
        sleep 1
        su - es -c "$ES_HOME/bin/elasticsearch -d -p pid"
        echo "elasticsearch is started"
        ;;
      *)
      echo "start|stop|restart"
      ;;
    esac
    exit 0

  • 相关阅读:
    Spring restful
    LDAP & Implementation
    Restful levels and Hateoas
    事务隔离的级别
    servlet injection analysis
    session and cookie
    write RE validation
    hello2 source analysis
    匿名函数和递归函数
    生成器和迭代器,列表推导式
  • 原文地址:https://www.cnblogs.com/gcm688/p/14308279.html
Copyright © 2011-2022 走看看