zoukankan      html  css  js  c++  java
  • Centos6.1 , Centos6.5 开机启动

    楼主2个服务器,一个是centos6.5  一个是6.1

       

        1.cat /etc/issue 查看版本,。

        centos 6.1  方法一,方法二都可以开机启动 (自定义的脚本)

        centos6.5  我这里测试只能方法二启动成功,或许是我系统未知问题导致(自定义的脚本)

        开机启动 2个方式:

        方法一 chkconfig 管理:

              第一步:  vi  /etc/init.d/test

              第二步:  

                            #! /bin/bash

                            # chkconfig:3 88 88

                             nohup python3 /root/xx.py > /dev/null 2>&1 &

                           保存

                
    第三步: chmod +x /etc/init.d/test 

                              #  添加到chkconfig,开机自启动

                               chkconfig --add test

                       具体chkconfig 命令查看: https://www.runoob.com/linux/linux-comm-chkconfig.html

      方法二  将服务启动命令加入到/etc/rc.d/rc.local中:

         #!/bin/sh

         #
         # This script will be executed *after* all the other init scripts.
         # You can put your own initialization stuff in here if you don't
         # want to do the full Sys V style init stuff.

         touch /var/lock/subsys/local

         nohup python3 /root/xx.py  > /dev/null 2>&1 &
       

      需要将完整路径写入,否则不起作用  (有软连接的不算)

               

  • 相关阅读:
    CentOS 7 SSH远程证书登陆
    Keepalived安装配置入门
    Docker-Compose 一键部署Ningx+.Net Core+Redis集群
    .Net Core Cookie跨站点共享 会话保持
    .Net Core EF Core之Sqlite使用及部署
    CentOS 7 Fail2ban防暴力破解
    CentOS 7 Nginx安装配置
    CentOS 7 Firewalld 常用操作
    Linux 修改SSH端口及禁用ROOT远程SSH登陆
    Mysql MariaDB安装
  • 原文地址:https://www.cnblogs.com/pythonSF/p/14488499.html
Copyright © 2011-2022 走看看