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

做网站大概费用视频制作软件app免费下载

做网站大概费用,视频制作软件app免费下载,上海网站开发方案,wordpress修改文件Linux定时同步系统时间到硬件时间 1. 系统时间、软件时间 系统时间 (System Time): 一般说来就是我们执行 date命令看到的时间,linux系统下所有的时间调 用(除了直接访问硬件时间的命令)都是使用的这个时…

Linux定时同步系统时间到硬件时间

1. 系统时间、软件时间

系统时间 (System Time): 一般说来就是我们执行 date命令看到的时间,linux系统下所有的时间调 用(除了直接访问硬件时间的命令)都是使用的这个时间。

硬件时间(Hardware Time): 主板上BIOS中的时间,由主板电池供电来维持运行,系统开机时要读 取这个时间,并根据它来设定系统时间(注意:系统启动时根据硬件时间设定系统时间的过程可能存在 时区换算,这要视具体的系统及相关设置而定)。

①. 系统时间

获取系统时间

# 查看当前系统时间
root@debian7:~# date
2024年 07月 24日 星期三 11:00:43 CST
root@debian7:~#

设置系统时间

# 仅设置时间
root@debian7:~# date -s 11:05:06
2024年 07月 24日 星期三 11:05:06 CST# 设置年月日时分秒
root@debian7:~# date -s "2024-07-24 11:07:20"
2024年 07月 24日 星期三 11:07:20 CST

②. 硬件时间

获取硬件时间

# 查看当前机器硬件时间
root@debian7:~# hwclock
2024年07月24日 星期三 11时08分55秒  -0.146566 seconds

将系统时间同步到硬件时间

# 同步硬件时间
root@debian7:~# hwclock --systohc

2. Linux定时任务配置

在Linux系统下,一般都用系统自带的Cron 完成各类任务的调度和执行。Cron任务一般通过 crontab 文件进行配置任务参数。

crontab配置文件通常位于 /etc/crontab目录下。

①. Crontab格式简介

/etc/crontab 文件内容如下:

root@debian7:~# cat /etc/crontab 
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin# m h dom mon dow user	command
17 *	* * *	root    cd / && run-parts --report /etc/cron.hourly
25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

关键字说明:

  • m : 表示分钟;
  • h : 表示小时;
  • dom : 表示日(day of month);
  • mon : 表示月;
  • dow : 表示周 (day of week);
  • user : 执行用户;
  • command : 执行脚本或者命令。

②. 添加定时任务

编辑 "/etc/crontab" 文件,增加《系统时间回写硬件时间》任务。

root@debian7:~# cat /etc/crontab 
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin# m h dom mon dow user	command
17 *	* * *	root    cd / && run-parts --report /etc/cron.hourly
25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
*/5 *   * * *   root    (hwclock --systohc)
#

其中 【*/5 * * * * root (hwclock --systohc)】是新加任务,每隔5分钟执行一次《系统时间回写硬件时间 》任务。

配置完后,重启cron任务。

③. Cron任务管理

  • 查看状态
service cron status
root@debian7:~# service cron status
[ ok ] cron is running.
  • 重启
service cron restart
root@debian7:~# service cron restart
[ ok ] Restarting periodic command scheduler: cron[....] Stopping periodic command scheduler: cron.
[ ok ] Starting periodic command scheduler: cron.
  • 停止
service cron stop
  • 启动
service cron start

④. 验证功能

调整系统时间,过5分钟后看系统硬件时间

测试过程:

root@debian7:~# 
root@debian7:~# hwclock                                  #1. 先查看固件时间 
2024年07月24日 星期三 11时47分53秒  -0.989923 seconds
root@debian7:~# 
root@debian7:~# date
2024年 07月 24日 星期三 11:47:56 CST                      #2. 查看系统时间
root@debian7:~# 
root@debian7:~# date -s 12:00:00                         #3. 将系统时间向前调了12分钟左右
2024年 07月 24日 星期三 12:00:00 CST
root@debian7:~# 
root@debian7:~# date
2024年 07月 24日 星期三 12:00:03 CST                      #4. 系统时间已被调整
root@debian7:~# 
root@debian7:~# hwclock                                  #5. 过几分钟后,查看固件时间,固件时间已被回写
2024年07月24日 星期三 12时01分20秒  -1.025367 seconds
root@debian7:~# 
root@debian7:~# date
2024年 07月 24日 星期三 12:01:21 CST
root@debian7:~# 
http://www.15wanjia.com/news/182028.html

相关文章:

  • 114百事通做网站600我自己的网站 怎样做防火墙
  • 如何快速网站排名十大旅游网站排名
  • 山东德州做网站万和城官方网站
  • 国内酷炫网站mip 网站模板
  • 手机端网站图片上传如何做用什么做wordpress
  • 网站开发工程师年薪多少中国建设工程造价网
  • 上海建站价格嘉兴网站制作建设
  • 如何做网站镜像wordpress 全站静态化
  • 做公众号还是网站门户网站建设谈判
  • 西安网站开发xamokj中建一局集团有限公司官网
  • 山东省优质校建设网站百度快速排名优化技术
  • 网站商城服务体系建设方案烟台市做网站找哪家好
  • 郑州区块链数字钱包网站开发多少钱网站制作和app制作
  • 大型门户网站建设一般多少钱分类网站建设多少钱
  • 上海网站开发设计北京做网站建设的公司有哪些
  • 物流公司网站建设有什么要点收废品做网站怎么做
  • 58同城企业网站怎么做的最经济 网站建设
  • 河北省建设局网站首页泰安电脑网站建设电话
  • php做网站主题多语言网站建设平台代理
  • 网站开发架构师天猫官网入口
  • 帝国网站搬家教程百度seo新算法
  • 成品网站源码是1688吗黄页网站推广app软件
  • 北京营销型网站案例安徽省城乡建设厅网站
  • 做离线版申报表进入哪个网站青岛搭建公司
  • 亚马逊跨境电商平台官网厦门百度推广优化排名
  • liunx做网站跳转法国注册公司流程和费用
  • 牛网网站建设支付宝小程序代理
  • 上海突发事件专业的seo外包公司
  • 网站模板下载网站有哪些企业营销策划实训
  • 重庆建站模板搭建网站建设7个基本流程分析