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

柳州关键词优化网站阿里云网站建设优化

柳州关键词优化网站,阿里云网站建设优化,昆明网络营销软件,免费推广中文黄页网文章目录 1 按天自动备份#xff08;归档#xff09;文件1.1 准备工作1.2 编写配置文件和归档脚本1.2.1 编写配置文件1.2.2 编写归档脚本 1.3 运行脚本1.4 运行分析1.5 添加到cron表中1.5.1 编辑cron表1.5.2 测试脚本是否可用 2 按小时自动备份#xff08;归档#xff09;文… 文章目录 1 按天自动备份归档文件1.1 准备工作1.2 编写配置文件和归档脚本1.2.1 编写配置文件1.2.2 编写归档脚本 1.3 运行脚本1.4 运行分析1.5 添加到cron表中1.5.1 编辑cron表1.5.2 测试脚本是否可用 2 按小时自动备份归档文件2.1 准备工作2.2 编写配置文件和归档脚本2.2.1 编写配置文件2.2.2 编写归档脚本 2.3 运行脚本2.4 运行分析2.5 添加到cron表中2.5.1 编辑cron表2.5.2 测试脚本是否可用 1 按天自动备份归档文件 1.1 准备工作 # 创建一个集中归档仓库目录 sudo mkdir /archive# 创建一个用户组的方式为需要在集中归档目录中创建文件的用户授权 sudo groupadd Archivers ## 更改目录所属组 sudo chgrp Archivers /archive ## 查看更改目录所属组是否成功 ls -ld /archive# 将需要备份的用户添加到用户组 sudo usermod -aG Archivers bobo# 修改目录权限 sudo chmod 775 /archive ## 查看修改目录权限是否成功 ls -ld /archive# 登出再登入使组成员关系生效 -- 效果只要是该组的成员无需超级用户权限就可以在目录中创建文件了。 exit 登录# 将目录的粘滞位加上 -- 效果为了防止其他用户不小心删除其他用户文件 sudo chmod t /archive ## 查看将目录的粘滞位加上是否成功如果设置了粘滞位输出中目录权限的最后一个字符会是一个 t ls -ld /archive1.2 编写配置文件和归档脚本 1.2.1 编写配置文件 # 创建配置文件 vi Files_To_Backup # 添加下面内容 -- 这里面的内容根据自己的需要进行配置/home/bobo/Project /home/bobo/Downloads /home/Does_not_exist /home/bobo/Documents# 将配置文件移动到 /archive 目录下面 mv Files_To_Backup /archive1.2.2 编写归档脚本 # 创建配置文件 vi Daily_Archive.sh # 添加下面内容#!/bin/bash # # Daily_Archive - Archive designated files directories ######################################################## # # Gather Current Date # DATE$(date %y%m%d) # # Set Archive File Name # FILEarchive$DATE.tar.gz # # Set Configuration and Destination File # CONFIG_FILE/archive/Files_To_Backup DESTINATION/archive/$FILE # ######### Main Script ######################### # # Check Backup Config file exists # if [ -f $CONFIG_FILE ] # Make sure the config file still exists. then # If it exists, do nothing but continue on.echoelse # If it doesnt exist, issue error exit script.echoecho $CONFIG_FILE does not exist.echo Backup not completed due to missing Configuration Fileecho exit fi # # Build the names of all the files to backup # FILE_NO1 # Start on Line 1 of Config File. exec $CONFIG_FILE # Redirect Std Input to name of Config File # read FILE_NAME # Read 1st record # while [ $? -eq 0 ] # Create list of files to backup. do # Make sure the file or directory exists. if [ -f $FILE_NAME -o -d $FILE_NAME ] then# If file exists, add its name to the list.FILE_LIST$FILE_LIST $FILE_NAME else# If file doesnt exist, issue warningechoecho $FILE_NAME, does not exist.echo Obviously, I will not include it in this archive.echo It is listed on line $FILE_NO of the config file.echo Continuing to build archive list...echo fi # FILE_NO$[$FILE_NO 1] # Increase Line/File number by one. read FILE_NAME # Read next record. done # ####################################### # # Backup the files and Compress Archive # echo Starting archive... echo # tar -czf $DESTINATION $FILE_LIST 2 /dev/null # echo Archive completed echo Resulting archive file is: $DESTINATION echo # exit1.3 运行脚本 # 为脚本添加执行权限 chmod ux Daily_Archive.sh ## 查看为脚本添加执行权限是否成功 ls -l Daily_Archive.sh# 运行脚本文件 ./Daily_Archive.sh# 查看运行结果 ls /archive1.4 运行分析 bobothj:~$ ./Daily_Archive.sh/home/Does_not_exist, does not exist. Obviously, I will not include it in this archive. It is listed on line 3 of the config file. Continuing to build archive list...Starting archive...Archive completed Resulting archive file is: /archive/archive240227.tar.gzbobothj:~$ ls /archive/ Files_To_Backup archive240227.tar.gz运行脚本之后如果待备份的文件不存在将不会被备份如果存在将会被备份。 1.5 添加到cron表中 1.5.1 编辑cron表 # 将脚本添加到 cron 表中以便每天自动执行归档脚本 crontab -e ## 选择你熟悉的编辑器我选择 vim 添加下面代码 -- 效果每月每周的每一天的0时0分执行这个脚本 0 0 * * * /home/bobo/Daily_Archive.sh ## 检查是否添加成功 crontab -l# 修改Daily_Archive.sh脚本以便添加一个日志处理错误修改情况如下bobothj:~$ head Daily_Archive.sh #!/bin/bash # # Set a daily_archive.log -- 效果将脚本的标准输出和错误输出重定向到日志文件 exec /home/bobo/daily_archive.log 21 # # Daily_Archive - Archive designated files directories ######################################################## # # Gather Current Date #1.5.2 测试脚本是否可用 # 运行脚本文件 ./Daily_Archive.sh# 查看日志文件 bobothj:~$ cat daily_archive.log/home/Does_not_exist, does not exist. Obviously, I will not include it in this archive. It is listed on line 3 of the config file. Continuing to build archive list...Starting archive...Archive completed Resulting archive file is: /archive/archive240227.tar.gz# 查看运行结果 ls /archive2 按小时自动备份归档文件 2.1 准备工作 # 创建一个集中归档仓库目录 sudo mkdir /archive/hourly# 上面已经创建组了这里就省略 ## 更改目录所属组 sudo chgrp Archivers /archive/hourly ## 查看更改目录所属组是否成功 ls -ld /archive/hourly# 将需要备份的用户添加到用户组 # 省略# 修改目录权限 sudo chmod 775 /archive/hourly ## 查看修改目录权限是否成功 ls -ld /archive/hourly# 登出再登入使组成员关系生效 -- 效果只要是该组的成员无需超级用户权限就可以在目录中创建文件了。 # 省略# 将目录的粘滞位加上 -- 效果为了防止其他用户不小心删除其他用户文件 sudo chmod t /archive/hourly ## 查看将目录的粘滞位加上是否成功如果设置了粘滞位输出中目录权限的最后一个字符会是一个 t ls -ld /archive/hourly2.2 编写配置文件和归档脚本 2.2.1 编写配置文件 # 创建配置文件 vi Files_To_Backup # 添加下面内容 -- 这里面的内容根据自己的需要进行配置/usr/local/Production/Machine_Errors /home/Development/Simulation_Logs# 将配置文件移动到 /archive/hourly 目录下面 mv Files_To_Backup /archive/hourly2.2.2 编写归档脚本 # 创建配置文件 vi Hourly_Archive.sh # 添加下面内容#!/bin/bash # # Hourly_Archive - Every hour create an archive ######################################################### # # Set Configuration File # CONFIG_FILE/archive/hourly/Files_To_Backup # # Set Base Archive Destination Location # BASEDEST/archive/hourly # # Gather Current Day, Month Time # DAY$(date %d) MONTH$(date %m) TIME$(date %k%M) # # Create Archive Destination Directory # mkdir -p $BASEDEST/$MONTH/$DAY # # Build Archive Destination File Name # DESTINATION$BASEDEST/$MONTH/$DAY/archive$TIME.tar.gz # ########## Main Script #################### # # Check Backup Config file exists # if [ -f $CONFIG_FILE ] # Make sure the config file still exists. then # If it exists, do nothing but continue on.echoelse # If it doesnt exist, issue error exit script.echoecho $CONFIG_FILE does not exist.echo Backup not completed due to missing Configuration Fileecho exit fi # # Build the names of all the files to backup # FILE_NO1 # Start on Line 1 of Config File. exec $CONFIG_FILE # Redirect Std Input to name of Config File # read FILE_NAME # Read 1st record # while [ $? -eq 0 ] # Create list of files to backup. do # Make sure the file or directory exists. if [ -f $FILE_NAME -o -d $FILE_NAME ] then# If file exists, add its name to the list.FILE_LIST$FILE_LIST $FILE_NAME else# If file doesnt exist, issue warningechoecho $FILE_NAME, does not exist.echo Obviously, I will not include it in this archive.echo It is listed on line $FILE_NO of the config file.echo Continuing to build archive list...echo fi # FILE_NO$[$FILE_NO 1] # Increase Line/File number by one. read FILE_NAME # Read next record. done # ####################################### # # Backup the files and Compress Archive # echo Starting archive... echo # tar -czf $DESTINATION $FILE_LIST 2 /dev/null # echo Archive completed echo Resulting archive file is: $DESTINATION echo # exit2.3 运行脚本 # 为脚本添加执行权限 chmod ux Hourly_Archive.sh ## 查看为脚本添加执行权限是否成功 ls -l Hourly_Archive.sh# 运行脚本文件 ./Hourly_Archive.sh# 查看运行结果 ls /archive/hourly2.4 运行分析 bobothj:~$ ./Hourly_Archive.shStarting archive...Archive completed Resulting archive file is: /archive/hourly/02/27/archive1343.tar.gzbobothj:~$ ls -l /archive/hourly/02/27/ total 4 -rw-r--r-- 1 bobo bobo 181 Feb 27 13:43 archive1343.tar.gz bobothj:~$ ./Hourly_Archive.shStarting archive...Archive completed Resulting archive file is: /archive/hourly/02/27/archive1344.tar.gzbobothj:~$ ls -l /archive/hourly/02/27/ total 8 -rw-r--r-- 1 bobo bobo 181 Feb 27 13:43 archive1343.tar.gz -rw-r--r-- 1 bobo bobo 181 Feb 27 13:44 archive1344.tar.gz备份成功~ 2.5 添加到cron表中 2.5.1 编辑cron表 # 将脚本添加到 cron 表中以便每天自动执行归档脚本 crontab -e ## 添加下面代码 -- 效果每月每周的每一天的0时0分执行这个脚本 0 0 * * * /home/bobo/Hourly_Archive.sh ## 检查是否添加成功 crontab -l# 修改Hourly_Archive.sh脚本以便添加一个日志处理错误修改情况如下bobothj:~$ head Hourly_Archive.sh #!/bin/bash # # Set a Hourly_Archive.log exec /home/bobo/hourly_archive.log 21 // 脚本的标准输出和错误输出重定向到日志文件 # # Hourly_Archive.sh - Archive designated files directories ######################################################## # # Gather Current Date #2.5.2 测试脚本是否可用 bobothj:~$ ./Hourly_Archive.sh bobothj:~$ cat hourly_archive.logStarting archive...Archive completed Resulting archive file is: /archive/hourly/02/27/archive1403.tar.gzbobothj:~$ ls /archive/hourly/02/27/ archive1343.tar.gz archive1344.tar.gz archive1403.tar.gz bobothj:~$
http://www.pierceye.com/news/400664/

相关文章:

  • 无锡做网站无锡网站设计2345网址导航手机上网导航下载
  • html中文美食网站营销型网站维护费用
  • 电商网站建设课设用什么软件制作网站
  • 杭州手机网站wordpress随机调用页面
  • html5网站编写长网页网站
  • 订餐网站系统建设方案建一个网上商城需要多少钱
  • 手机网站asp付费抽奖网站怎么做
  • 国际网站哪里做vs2010 c 建设网站
  • 企业网站更新什么内容永城做网站
  • wordpress 众筹网站模板html5风格网站特色
  • 服装设计参考网站重庆景点排名
  • 网至普的营销型网站建设扬州网站商城建设价格表
  • 成品网站价格表简答网站内容建设的时候内链重要性
  • 视频链接生成器某网站搜索引擎优化
  • flash网站案例vi设计是设计什么
  • ip查询网站备案查询企业网络营销推广平台
  • 多城市网站建设免费制作小程序的平台
  • 郑州网站建设出名吗?wordpress获取登录密码
  • 网站建设论文的开题报告重庆市工程建设信息
  • 商务网站设计方案门户网站的优点
  • 河津网站制作wampserver做的网站
  • 洛阳专业网站设计开发制作建站公司零陵区住房和城乡建设局网站
  • 在哪里可以学做网站游戏开发大亨下载
  • 找人做ps的网站无锡 做公司网站
  • 云速建站可以建个人网站吗wordpress仿站难吗
  • 如何取外贸网站域名凡科h5制作教程
  • 蜘蛛不抓取网站的原因中山h5网站建设
  • 百度免费推广网站建网站用的免费软件
  • 网站建设西安哪里好广州做企业网站的公司
  • 汉中市网站建设爱墙 网站怎么做