玩龙天子 发表于 2018-9-29 14:15:22

linux下的apache、mysql自启动

  myslq.server的启动脚本程序=》 复制/etc/rc.d/init.d目录
  # cd /etc/rc.d/init.d
  复制并重命名为mysql
  # cp /usr/local/mysql/support-files/mysql.server mysql
  更改属性改为“x”(executable,可执行)
  #chmod +x mysql
  添加到系统的启动服务组中
  chkconfig --add mysql
  启动服务
  service mysql start
  另:确认
  chkconfig --list 用来列表服务 来确认
  chkconfig --list 或 chkconfig --list
  chkconfig --add name 添加服务
  chkconfig --del name删除服务
  2. Apache 自动启动的配置
  方法一:
  apachectl命令拷贝至/etc/rc.d/init.d目录下,改名为httpd
  使用编辑器打开httpd文件,并在第一行#!/bin/sh下增加两行文字如下
  # chkconfig: 35 70 30
  # description: Apache
  接着注册该服务
  chkconfig --add httpd
  
  service httpd start
  其中所增加的第二行中三个数字第一个表示在运行级别3和5下启动apache,
  第二、三是关于启动和停止的优先级配置,无关紧要
  方法二: 在/etc/rc.d/rc.local中增加启动apache的命令,例如:/usr/local/httpd/bin/apachectl start
  
  启动服务

页: [1]
查看完整版本: linux下的apache、mysql自启动