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

网站风格包括哪些北京房山网站建设产品更新培训

网站风格包括哪些,北京房山网站建设产品更新培训,女性时尚网站带论坛php程序,教育 企业 重庆网站建设文章目录 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/334681/

相关文章:

  • wordpress建站吧做网站接专线费用
  • c 做网站设计广东seo点击排名软件哪里好
  • 微网站微网站seo服务理念
  • 建设网站招聘商标注册查询官网网站
  • 建设彩票网站合法吗新浪sae 搭建wordpress
  • 加热器网站怎么做的课程网站建设规划方案
  • 网站建设目标文档鄂州网站制作哪家好
  • 廉政建设网站微信运营
  • 什么样的网站结构适合做seo北京互联网建站网站
  • 工程科技 网站设计广东做seo的公司
  • 外贸都是在哪些网站做怎么做个手机版的网站
  • 北京社保网站做社保增减员锦绣大地seo官网
  • 分析影响网站排名的因素河南省住房和城乡建设厅网站文件
  • 宁城网站建设公司引流最好的推广方法
  • 辽宁省建设厅官方网站网站免费正能量直接进入浏览器下载安装
  • 怎么给公司建网站广州互联网营销师培训
  • 用阿里云做网站注意事项绵阳的网站建设公司哪家好
  • 电商网站设计工作内容深圳国际设计学院
  • 国内界面优秀的网站科技有限公司名字叫什么好
  • 网站底部悬浮代码搭建网站的主要风险
  • 长安网站建设公司常做网站首页的文件名
  • 学网站开发的能找什么工作赣州网站设计较好的公司
  • 网站建设接单微信营销软件收费排行榜
  • 佛山网站建设公司排名佛山微网站推广哪家专业
  • 招商网站建设网设备 光速东莞网站建设
  • 网站建设公司如何wordpress用多大主机
  • 东莞网站建设规范网页美工设计(第2版)素材
  • 论文 网站建设值得推荐的深圳app外包公司
  • 建网站的电脑可以换位置吗莆田建站培训
  • 外贸必看网站离职模板网