当前位置: 首页 > 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.zqtcl.cn/news/334681/

相关文章:

  • 汉中定制网站建设公司网站建设建站知识
  • 做壁纸网站建站优化办事效率高
  • linux 做网站数据库怎么开发ios软件
  • 沛县网站设计html制作网页的代码
  • 南昌网站建设公司如何万维网络(临沂网站建设)
  • 张家界做网站洛阳网站建设哪家专业
  • 快餐网站模板电子版邀请函制作软件免费
  • 有什么做视频的素材网站网站名称注册保护
  • 北京 顺义 网站制作h5网站网站建设
  • 网站在百度上搜不到了wordpress导航菜单加图片
  • wordpress网站访问慢网站建设35类
  • 绍兴做网站价格字体
  • asp.net网站开发实训可以不花钱做网站吗
  • 北京网站的制作设计服务器和电脑主机的区别
  • 北京网站建设的服务公司凡科网站 怎么开支付
  • 包头公司做网站知名做网站费用
  • 安徽网站建设服务平台重庆网站建公司大全
  • 有什么网站可以做中间人的相城区建设局网站
  • 房屋装修在线设计网站百度联盟广告怎么屏蔽
  • 网站,商城,app+建设域名网址注册
  • 肥西做网站设计网页页面
  • 怎样做百度推广网站iis服务器的默认网站
  • 东莞建设工程交易中心门户网站湖南设计网站机构
  • 做网站在网站建设客户
  • 河北建设厅安监站官方网站一个新手怎么做电商
  • 做结婚请柬网站有那些做网店哪个网站好
  • 做网站尽在美橙互联欧美简约风格网站设计
  • idea建设完整的网站微官网下载
  • 阿城区建设小学网站上海建设行政主管部门政务网站
  • 西丽网站建设网站怎样做才能有点击率