此为用户twk的备份执行方案(192.168.42.246虚拟机数据库,备份到192.168.42.147的第二硬盘)
此为用户twk的备份执行方案(192.168.42.5虚拟机数据库,备份到192.168.42.147的第二硬盘)
思路:
共享192.168.42.5的AppServ,关闭windows防火墙
建立mount文件夹,挂载AppServer,
在sdb1建立airfreightdb文件夹,建立sh(设定自动删除7日前的备份),
sh添加到排程crontab

ticketingdb步骤:
#mkdir /mnt/ticketingdb
#mount -t cifs -o username=administrator,password=xxxxx //192.168.42.246/AppServ /mnt/ticketingdb
#ll /mnt/ticketingdb
#mkdir /mnt/sdb1/ticketingdb

airfreightdb步骤:
#mkdir /mnt/airfreightdb
#mount -t cifs -o username=admin,password=XXXXXXXX //192.168.42.5/AppServ /mnt/airfreightdb
#ll /mnt/airfreightdb
#mkdir /mnt/sdb1/airfreightdb
备份路径:可备份到同一文件夹,也可以备份到不同的文件夹,以管理员习惯为准。
#vi ai+ti.sh
*****************************************************************************************
mount -t cifs -o username=administrator,password=xxxxxxxxxx //192.168.42.246/AppServ /mnt/ticketingdb
mount -t cifs -o username=admin,password=xxxxxxxxx  //192.168.42.5/AppServ /mnt/airfreightdb
DATE=`date +%Y-%m-%d`
tar -cvzf /mnt/sdb1/airfreightdb/airfreightdb.$DATE.tar.gz  /mnt/airfreightdb
find /mnt/sdb1/airfreightdb -type f -mtime +7 -exec rm -f {} \;
tar -cvzf /mnt/sdb1/ticketingdb/ticketingdb.$DATE.tar.gz  /mnt/ticketingdb
find /mnt/sdb1/ticketingdb -type f -mtime +7 -exec rm -f {} \;
#
#backup airfreight database and ticketing database to 192.168.42.147 second HD /mnt/sdb1
******************************************************************************************
#crontab -e
#05 20 * * *      /root/ai+ti.sh
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
补充说明
例如:
今天是1-11号,查找第五天前当日(  -mtime x )
-mtime 0   就是1-11号
-mtime 5   就是1-6号
......
留意一点mtime是以24小时计算的,不足24小时会被计算为当天。

最近访问时间 access time (-atime)

最近更改时间 modify time (-mtime)

最近状态改动时间 change time(-ctime)

实例 centos自动挂载、备份windows共享文件夹,并删除第7日前当天的备份的更多相关文章

  1. centos 配置 samba 与windows共享文件夹

    yum install samba /etc/samba/smb.conf directory mask = 0777 ← 指定新建目录的属性(以下4行) force directory mode = ...

  2. CentOS访问Windows共享文件夹的方法

    CentOS访问Windows共享文件夹的方法 1 在地址栏中输入下面内容: smb://Windows IP/Share folder name,smb为Server Message Block协议 ...

  3. 烂泥:CentOS6.5挂载windows共享文件夹

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 由于工作需要,需要把本机的文件夹共享出去,然后让CentOS服务器临时使用下. 服务器使用的是CentOS系统,而本机使用的win7系统.考虑到是临时使 ...

  4. windows共享文件夹如何让CentOS 6.5读取

    http://www.111cn.net/sys/CentOS/74104.htm 工作需要,需要把本地win7共享的文件夹让CenotOS 6.5服务器临时使用一下,以下是CentOS 6.5系统挂 ...

  5. samba 挂载windows共享文件夹

    先转载一片文章     centOS下yum安装配置samba 地址 http://blog.csdn.net/linglongwunv/article/details/5212875 遇到问题1 # ...

  6. centos7挂载Windows共享文件夹(学习笔记)

    centos7挂载windows共享文件夹 练习环境:centos7是安装在台式机的虚拟机,Windows共享文件夹是公司服务器的共享文件夹(已设置好的共享) 步骤 1. 设置挂载点:mkdir /m ...

  7. windows共享文件夹给centOS

    服务器使用的是CentOS系统,而本机使用的win7系统.考虑到是临时使用,所以就不打算搭建FTP和Samba服务器,直接通过CentOS挂载windows共享文件夹的方式来达到此目的. 既然是使用w ...

  8. Linux 挂载windows共享文件夹

    Linux 挂载windows共享文件夹 准备工具: 1.windows 共享出来文件夹. 2.Linux 安装cifs文件挂载属性 3.其他 windows ip: 192.168.27.99 Li ...

  9. Linux 挂载Windows共享文件夹和NAS存储

    summary: [Linux 挂载共享存储] 概述 将Windows共享文件夹和NAS存储挂载至Linux. Linux系统环境:CentOS 挂载共享存储 查看外部主机共享了哪些目录 smbcli ...

随机推荐

  1. POJ 2007 Scrambled Polygon [凸包 极角排序]

    Scrambled Polygon Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 8636   Accepted: 4105 ...

  2. 联合查询到gridview

    using com.DAL.Base; using DAL.ruanmou; using System; using System.Collections.Generic; using System. ...

  3. 发生Windows无法访问远程共享的解决办法

    发现问题 今天在访问远程时发生一个很郁闷的网络错误,如下图所示 问题修复步骤 这个问题可以采用以下步骤来修复 Step1.添加网络映射盘 添加网络映射时选择使用其他凭据登陆,这样就有机会让Window ...

  4. I can do it

    If it doesn't challange you ,it won't change you.

  5. fifteen-puzzle

    http://www.math.ubc.ca/~cass/courses/m308-02b/projects/grant/fifteen.html http://jamie-wong.com/2011 ...

  6. MySQL5.7 group by新特性,报错1055

    项目中本来使用的是mysql5.6进行开发,切换到5.7之后,突然发现原来的一些sql运行都报错,错误编码1055,错误信息和sql_mode中的"only_full_group_by&qu ...

  7. selenium自动化测试——常见的八种元素定位方法

    selenium常用的八种元素定位方法 1.通过 id 定位:find_element_by_id() 2.通过 name 定位:find_element_by_name() 3.通过 tag 定位: ...

  8. java定时器schedule和scheduleAtFixedRate区别

    package cn.lonecloud.test; import java.util.Date; import java.util.Timer; import java.util.TimerTask ...

  9. TzObjectInspector 一例

    TzObjectInspector Github上的一个开源组件!可以做到类似Delphi IDE属性,事件面板的样式!作者持续更新中... 看起来是这个样子: 这个东西用起来并不像想象的那样可以直接 ...

  10. Python基础——字符串

    Python版本:3.6.2  操作系统:Windows  作者:SmallWZQ 在Python中,字符串也是一种数据类型.相比其它数据类型,字符串算是比较复杂的.为何呢?因为字符串不仅包含英文字母 ...