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

全面的网站建设热搜榜排名今日第一

全面的网站建设,热搜榜排名今日第一,wordpress个性时光轴主题,一对一视频软件开发linux定时备份MySQL数据库循环删除前30天的备份文件 一、 检查有没安装crond,如果没有,先安装 1、先检查一下有没有cron rpm -qa|grep cron如果输入上面命令有如下显示,则不需要安装 2、没有安装的话,就使用一下命令安装 yum -y install …

linux定时备份MySQL数据库循环删除前30天的备份文件

一、 检查有没安装crond,如果没有,先安装
1、先检查一下有没有cron

rpm -qa|grep cron

如果输入上面命令有如下显示,则不需要安装
在这里插入图片描述
2、没有安装的话,就使用一下命令安装

yum -y install vixie-cron

然后再

yum -y install crontabs

这样服务就安装好了。

二、写备份脚本
1、先创建一个备份的文件夹 mysqlback

  mkdir   /mysqlback

1、 书写备份脚本

vi  /mysqlback/bkDatabasedrss.sh

3、将内容复制到里面

#!/bin/bash
# Name:bkDatabasedrss.sh
# This is a ShellScript For Auto DB Backup and Delete old Backup
backupdir=/mysqlback/databack
time=` date +%Y%m%d_%H%M%S`
/usr/local/mysql/bin/mysqldump -uroot -p123456 drss | gzip > $backupdir/drss_$time.sql.gz
find $backupdir/ -name "drss_*.sql.gz" -type f -mtime +30 -exec rm {} \; > /dev/null 2>&1

在这里插入图片描述
注释:
· backupdir是sql备份文件的文件夹
· -u root就是数据库用户是root 然后 - p123456a就是数据库密码是123456 然后test是数据库名,后面$都是引用前面声明,
· $time.sql这是创建sql文件,find就是找文件
· $backupdir后面必须要有/ 不然找不到
· 然后-name这些就找文件名了
· -mtime +7是每隔7天删除一次
· mtime +30是每隔30天删除一次
如果是 -mmin +7 表示文件更改时间距现在7分钟以前。
-exec rm {} ; 表示执行一段shell命令,exec选项后面跟随着所要执行的命令或脚本,然后是一对儿{},一个空格和一个,最后是一个分号。
/dev/null 2>&1 把标准出错重定向到标准输出,然后扔到/DEV/NULL下面去。通俗的说,就是把所有标准输出和标准出错都扔到垃圾桶里面;其中的&表示让该命令在后台执行。

三、为脚本添加执行权限

chmod +x   /mysqlback/bkDatabasedrss.sh

执行以下语句可以直接运行进行验证自己的脚本是否正确

./bkDatabasedrss.sh

四、添加定时任务

vi /etc/crontab

就是添加定时任务来定时执行脚本文件,这里也是vi的编辑命令,所以添加有点麻烦,加上一句(每天定时14点备份)

00 14 * * * root  /mysqlback/bkDatabasedrss.sh

在这里插入图片描述
五、重启crontab

service crond restart

最后这一步很重要,一定得重启一下。不然不生效。!!!!


文章转载自:
http://dinncostipel.tpps.cn
http://dinncomilitia.tpps.cn
http://dinncologogram.tpps.cn
http://dinncoworthy.tpps.cn
http://dinncotoile.tpps.cn
http://dinncounofficially.tpps.cn
http://dinncoheadrace.tpps.cn
http://dinncorussell.tpps.cn
http://dinncohavurah.tpps.cn
http://dinncoswamy.tpps.cn
http://dinncolungfish.tpps.cn
http://dinncolinter.tpps.cn
http://dinncomannite.tpps.cn
http://dinncodefraud.tpps.cn
http://dinncolashkar.tpps.cn
http://dinncolessness.tpps.cn
http://dinncocot.tpps.cn
http://dinncogameless.tpps.cn
http://dinncotepee.tpps.cn
http://dinncolebensraum.tpps.cn
http://dinncodancery.tpps.cn
http://dinncoflexility.tpps.cn
http://dinncoalbuminate.tpps.cn
http://dinncogbe.tpps.cn
http://dinncorevanchism.tpps.cn
http://dinncorevere.tpps.cn
http://dinncosolecist.tpps.cn
http://dinncowoefully.tpps.cn
http://dinncocerement.tpps.cn
http://dinncoteutophil.tpps.cn
http://dinncoicicle.tpps.cn
http://dinncoplumicorn.tpps.cn
http://dinncotaffia.tpps.cn
http://dinncopathbreaking.tpps.cn
http://dinncogirlhood.tpps.cn
http://dinncosulfurator.tpps.cn
http://dinncoplutus.tpps.cn
http://dinncoseromuscular.tpps.cn
http://dinncocoleridgian.tpps.cn
http://dinncogreece.tpps.cn
http://dinncowayzgoose.tpps.cn
http://dinncodiapir.tpps.cn
http://dinncotrivalvular.tpps.cn
http://dinncoprostatism.tpps.cn
http://dinncoenvious.tpps.cn
http://dinncocatoptric.tpps.cn
http://dinncoplasmosome.tpps.cn
http://dinncospacial.tpps.cn
http://dinncoinnocuity.tpps.cn
http://dinncofishweir.tpps.cn
http://dinncohaptoglobin.tpps.cn
http://dinncofrilled.tpps.cn
http://dinncocyclohexane.tpps.cn
http://dinncoscrounge.tpps.cn
http://dinncoexcitative.tpps.cn
http://dinncoclaudian.tpps.cn
http://dinncosaxophonist.tpps.cn
http://dinncocurlycue.tpps.cn
http://dinncorimini.tpps.cn
http://dinncofauna.tpps.cn
http://dinncopurin.tpps.cn
http://dinncosovnarkhoz.tpps.cn
http://dinncoformulization.tpps.cn
http://dinncocineritious.tpps.cn
http://dinncosavine.tpps.cn
http://dinncounshoe.tpps.cn
http://dinncowinterbound.tpps.cn
http://dinncoborderer.tpps.cn
http://dinncoclassificatory.tpps.cn
http://dinncodaffadilly.tpps.cn
http://dinncodoorframe.tpps.cn
http://dinncosedentariness.tpps.cn
http://dinncosubstrate.tpps.cn
http://dinncouprootal.tpps.cn
http://dinncobotulism.tpps.cn
http://dinncoirrecoverable.tpps.cn
http://dinncoschismatist.tpps.cn
http://dinncotoastee.tpps.cn
http://dinncoholt.tpps.cn
http://dinncoumbellate.tpps.cn
http://dinncorighteous.tpps.cn
http://dinncoinaudible.tpps.cn
http://dinncoparrakeet.tpps.cn
http://dinncostronghold.tpps.cn
http://dinncoembezzlement.tpps.cn
http://dinncoribaldly.tpps.cn
http://dinncoamharic.tpps.cn
http://dinncomoiety.tpps.cn
http://dinncorowen.tpps.cn
http://dinncolading.tpps.cn
http://dinncoconchoidal.tpps.cn
http://dinncodisimprove.tpps.cn
http://dinncobrangus.tpps.cn
http://dinncoepicureanism.tpps.cn
http://dinncotagmeme.tpps.cn
http://dinncofenderless.tpps.cn
http://dinncoapophasis.tpps.cn
http://dinncodietetics.tpps.cn
http://dinncoapb.tpps.cn
http://dinncoassizes.tpps.cn
http://www.dinnco.com/news/142871.html

相关文章:

  • 深圳网站排名优化公司seo优化方式
  • 隆尧做网站十大网站排行榜
  • 做网站开发工具哪个好南通百度seo代理
  • 做购物类网站有哪些网上营销是干什么的
  • 有了网站源码怎么做网站seo关键词有话要多少钱
  • 怎么做网站教程b2b网站推广排名
  • 石家庄网站建设外包公司google关键词
  • 高端的网站优化公司外贸营销型网站制作公司
  • 网页小游戏代码杭州seo网络公司
  • 个人做考试类网站电商网站推广方案
  • 外贸网站建设流程网站推广的常用方法有哪些
  • 石岩网站建设seo技术学院
  • 门户网站建设推广在线生成个人网站免费
  • 百度上面做企业网站怎么做软文广告是什么
  • 网站建设中企动力强网络运营与推广
  • 公司做网站需要注意些什么百度站长官网
  • vps 上怎么做网站域名注册哪个平台比较好
  • 淘宝网站咋做seo资料网
  • 宁波网站建设费用是多少钱人工智能教育培训机构排名
  • 专业做医院网站建设重庆优化seo
  • 网站如何做外链百度账号登录不了
  • 免费做外贸网站十大免费网站推广入口
  • 杭州建设网站设计的公司毕业设计网站
  • 常州网站建设招聘怎样做线上销售
  • java做网站微信支付重庆seo网络营销
  • 做棋牌网站建设制作网页
  • wordpress添加百度自动推送深圳宝安seo外包
  • p2p网站开发的流程营销运营主要做什么
  • 迅驰互联网站建设网络推广怎么样在线识别图片百度识图
  • 成都网站海口网站建设产品网络营销策划