Linux:Apache_MySQL随机启动关闭
Linux下Apache随机启动 cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apached chmod +x /etc/rc.d/init.d/ap
Apache源于NCSAhttpd服务器,经过多次修改,成为世界上最流行的Web服务器软件之一。Apache取自“a patchy server”的读音,意思是充满补丁的服务器,因为它是*软件,所以不断有人来为它开发新的功能、新的特性、修改原来的缺陷。Apache的特点是简单、速度快、性能稳定,,并可做代理服务器来使用。
Linux下Apache随机启动
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apached
chmod +x /etc/rc.d/init.d/apached
ln -s /etc/rc.d/init.d/apached /etc/rc3.d/S100apache
ln -s /etc/rc.d/init.d/apached /etc/rc0.d/K100apache
mysql随机启动
默认配置
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql
chmod +x /etc/rc.d/init.d/mysql
ln -s /etc/rc.d/init.d/mysql /etc/rc3.d/S100mysql
ln -s /etc/rc.d/init.d/mysql /etc/rc0.d/K100mysql
非默认安装 比如配置在/opt/mysql_server中 创建启动文件/opt/mysql_server/start.sh
#!/bin/sh
rundir="/opt/mysql_server";
echo $rundir;
/usr/local/mysql/bin/mysqld_safe --defaults-file="$rundir"/my.cnf --pid-file="$rundir"/mysql.pid --datadir="$rundir"/data --socket="$rundir"/mysql.sock --user=mysql --log-error="$rundir"/error.log --log-slow-queries="$rundir"/slow_query.log&
创建停止文件/opt/mysql_server/stop.sh
#!/bin/sh
rundir="/opt/mysql_server";
echo $rundir;
/usr/local/mysql/bin/mysqladmin -uroot -pctech --socket="$rundir"/mysql.sock shutdown
创建配置文件my.cnf
[mysqld]
port = 8211
skip-locking
skip-innodb
skip-name-resolve
set-variable = back_log=600
set-variable = key_buffer=4M
set-variable = max_allowed_packet=2M
set-variable = table_cache=512
set-variable = sort_buffer=16M