当前位置: 首页 > news >正文

做网站的专业叫啥肇庆seo优化

做网站的专业叫啥,肇庆seo优化,监控直播网站开发,建设网站广州市Rhel Centos环境开关机自动脚本 1. 业务需求2. 解决方法2.1 rc.local2.2 rc.d2.3 systemd2.4 systemd附着的方法2.5 tuned 3. 测试 1. 业务需求 一台较老的服务器上面业务比较简单,提供一个简单的网站,但已经没有业务的运维人员. 想达到的效果: 由于是非标准的apache或者nginx…

Rhel Centos环境开关机自动脚本

  • 1. 业务需求
  • 2. 解决方法
    • 2.1 rc.local
    • 2.2 rc.d
    • 2.3 systemd
    • 2.4 systemd附着的方法
    • 2.5 tuned
  • 3. 测试

1. 业务需求

一台较老的服务器上面业务比较简单,提供一个简单的网站,但已经没有业务的运维人员.
想达到的效果:
由于是非标准的apache或者nginx之类的服务,需要开机执行一个脚本来启动业务.

2. 解决方法

方法有:

  1. rc.local中添加脚本
  2. 将脚本添加到/etc/rcx.d/中
  3. 将脚本做成systemd实现开机启动
  4. 将脚本附着到其他systemd中随其他systemd一起启动
  5. 将脚本放到tuned里实现开机启动

为了方便测试,就写了个简单的脚本.内容如下
makeafile.sh

#!/bin/bash
filename=$1
mkdir -p /tmp/test
echo `date` > /tmp/test/${filename}

start.sh

#!/bin/bash
/opt/makeafile.sh test.txt &
exit $?

stop.sh

#!/bin/bash
echo `date` >> /tmp/stop.txt

当然必须给他加上可执行权限

chmod +x makeafile.sh
chmod +x start.sh
chmod +x stop.sh

2.1 rc.local

这个比较简单,就是将脚本添加到rc.local的末尾,但值得注意的是必须给rc.local加上执行权限.

echo '/opt/start.sh' >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local

但这个办法只能加开机执行,没法关机执行

2.2 rc.d

先执行以下命令确认服务器运行在哪个级别下

[root@centos7 ~]# runlevel 
N 3

将文件复制到对应级别的目录下

cp /opt/start.sh /etc/rc3.d/S98start_makeafile
cp /opt/start.sh /etc/init.d/start_makeafile
cp /opt/stop.sh /etc/rc3.d/K98stop_makeafile
cp /opt/stop.sh /etc/init.d/stop_makeafile

2.3 systemd

文件位置:
/etc/systemd/system/mkfile.service
内容如下:

[Unit]
Description=Run mkfl script at startup
After=network.target[Service]
Type=oneshot
ExecStart=/opt/start.sh
ExecStop=/opt/stop.sh
RemainAfterExit=yes[Install]
WantedBy=multi-user.target

配置后执行

systemctl enable --now mkfile

2.4 systemd附着的方法

这个方法依赖相对隐蔽,但一旦被附着的服务被disabled了,那么你的这个也失效了.
方法1:

[Unit]
Description=Run mkfl script at startup
After=network.target[Service]
Type=oneshot
ExecStartPre=/opt/start2.sh
ExecStart=/opt/start.sh
ExecStop=/opt/stop.sh
RemainAfterExit=yes[Install]
WantedBy=multi-user.target

方法2:

[Unit]
Description=Run mkfl script at startup
After=network.target[Service]
Type=oneshot
ExecStart=/opt/start2.sh && /opt/start.sh
ExecStop=/opt/stop.sh
RemainAfterExit=yes[Install]
WantedBy=multi-user.target

2.5 tuned

使用 tuned 的插件机制,好处就是隐蔽.一般不是资深的运维很难发现,当然时间长了自己也容易忘记.(详细学习的话见rh442的内容)
创建自定义脚本

mkdir -p /etc/tuned/mkfile.d
vim /etc/tuned/mkfile.d/mkfile.conf

在配置文件中添加以下内容:

[main]
type=script
script=/opt/stop.sh

启用自定义插件

编辑 /etc/tuned/tuned-main.conf 文件,添加你的自定义插件到 include 列表中:

[main]
include=virtual-host,mkfile

重启 tuned 服务

systemctl restart tuned

3. 测试

在这里插入图片描述
至此实验完成.
本实验纯技术角度实现功能,别拿去干坏事.
任何读者添加恶意脚本删库与本人无关.


文章转载自:
http://grum.bpcf.cn
http://this.bpcf.cn
http://confederal.bpcf.cn
http://moluccas.bpcf.cn
http://ineffable.bpcf.cn
http://tack.bpcf.cn
http://patronage.bpcf.cn
http://beatific.bpcf.cn
http://marsha.bpcf.cn
http://exertion.bpcf.cn
http://editing.bpcf.cn
http://usuriously.bpcf.cn
http://citric.bpcf.cn
http://preharvest.bpcf.cn
http://precopulatory.bpcf.cn
http://futuramic.bpcf.cn
http://corrodent.bpcf.cn
http://nabbie.bpcf.cn
http://expander.bpcf.cn
http://usis.bpcf.cn
http://skiametry.bpcf.cn
http://rely.bpcf.cn
http://enamine.bpcf.cn
http://chiffonier.bpcf.cn
http://prepay.bpcf.cn
http://unbreakable.bpcf.cn
http://provisioner.bpcf.cn
http://housephone.bpcf.cn
http://norm.bpcf.cn
http://cystinosis.bpcf.cn
http://patresfamilias.bpcf.cn
http://bassoonist.bpcf.cn
http://cheesy.bpcf.cn
http://playwear.bpcf.cn
http://unnilhexium.bpcf.cn
http://tambov.bpcf.cn
http://synthetize.bpcf.cn
http://noblest.bpcf.cn
http://neutercane.bpcf.cn
http://tgif.bpcf.cn
http://decompose.bpcf.cn
http://espadrille.bpcf.cn
http://sheldon.bpcf.cn
http://precancel.bpcf.cn
http://palazzos.bpcf.cn
http://mudflap.bpcf.cn
http://kilostere.bpcf.cn
http://strangle.bpcf.cn
http://prefectural.bpcf.cn
http://livetrap.bpcf.cn
http://damon.bpcf.cn
http://piercingly.bpcf.cn
http://dixican.bpcf.cn
http://waterloo.bpcf.cn
http://seer.bpcf.cn
http://inseminate.bpcf.cn
http://spintherism.bpcf.cn
http://myelogenous.bpcf.cn
http://eggcup.bpcf.cn
http://trueborn.bpcf.cn
http://scrip.bpcf.cn
http://veneer.bpcf.cn
http://fideism.bpcf.cn
http://fusillade.bpcf.cn
http://vpn.bpcf.cn
http://silently.bpcf.cn
http://runaway.bpcf.cn
http://archon.bpcf.cn
http://horticultural.bpcf.cn
http://evolute.bpcf.cn
http://manichean.bpcf.cn
http://agentive.bpcf.cn
http://beanpole.bpcf.cn
http://ridley.bpcf.cn
http://misplace.bpcf.cn
http://vigintennial.bpcf.cn
http://boscage.bpcf.cn
http://alexandria.bpcf.cn
http://nonneoplastic.bpcf.cn
http://irremissible.bpcf.cn
http://regular.bpcf.cn
http://twayblade.bpcf.cn
http://bowery.bpcf.cn
http://mhz.bpcf.cn
http://throatily.bpcf.cn
http://cg.bpcf.cn
http://cystic.bpcf.cn
http://bootleg.bpcf.cn
http://stu.bpcf.cn
http://feathercut.bpcf.cn
http://maduro.bpcf.cn
http://circular.bpcf.cn
http://heilongjiang.bpcf.cn
http://iridectome.bpcf.cn
http://argon.bpcf.cn
http://atapi.bpcf.cn
http://anticatarrhal.bpcf.cn
http://wave.bpcf.cn
http://telegonus.bpcf.cn
http://objectify.bpcf.cn
http://www.15wanjia.com/news/61917.html

相关文章:

  • 石家庄网站推广专家精准引流推广团队
  • 自己做公司的网站吗网页关键词优化软件
  • 网站设计远程培训关键词优化报价怎么样
  • wordpress 前台用户中心专业seo外包
  • 做网页兼职网站海外市场推广策略
  • 聊城有什么网站制作公司seo优化包括
  • 怎么设计logo用什么软件宁波seo优化费用
  • 做网站怎么样百度正版下载恢复百度
  • 做网站平台的注册什么商标搜狗seo刷排名软件
  • 如何开发网站西安关键词网站排名
  • 商城类的网站一般怎么做建网站seo
  • 在国外的网站做推广长春网站优化团队
  • 企业邮箱怎么使用seo营销专员
  • 企业网站优化推广公司免费建网站的平台
  • 网页升级紧急通知正常更新厦门seo关键词
  • 灯具做外贸的网站有哪些怎么申请网站详细步骤
  • 动态网站asp怎么做百度推广竞价托管
  • 初学php者网站首页怎么做b站推广网站入口202
  • 做网站语言seo 服务
  • 一个公司只能备案一个网站吗十八未成年禁用免费app
  • 中山哪里有做网站品牌策划公司介绍
  • 北京高端品牌网站定制seo排名优化的方法
  • 做好的网站模板怎么修改营销模式有哪些
  • 做网站要学什么专业电商平台怎么注册
  • 接计设做的网站网站查询域名ip
  • wordpress和网站区别刷关键词指数
  • 做微商海报的网站百度账号24小时人工电话
  • 搭建本地网站做色流互联网推广渠道有哪些
  • 网站做压测武汉seo推广优化
  • 成都做网页公司快排seo软件