您的位置 首页 > 德语词汇

replay是什么意思?用法、例句?Linux scriptreplay回放你的高光时刻

大家好,关于replay是什么意思?用法、例句很多朋友都还不太明白,今天小编就来为大家分享关于Linux scriptreplay回放你的高光时刻的知识,希望对各位有所帮助!

scriptreplay用于在终端中,根据script命令记录的终端数据文件和时间日志文件,重现当时用户的所有操作和命令的输出信息。简而言之,重现播放当时终端会话发生的一切信息,而不是重新运行一遍命令。例如,用户当时在输入某条命令时,字符的键入和删除也都会被重现。非常适合用于教程演示场合。而且,在机器A上面使用script命令记录终端操作,可以在机器B上面使用scriptreplay命令重新播放。

replay是什么意思?用法、例句?Linux scriptreplay回放你的高光时刻

scriptreplay[options][-t]timingfile[typescript[divisor]]\n选项\n-t,--timingfile#记录时间日志的文件名称\n-s,--typescriptfile#记录终端数据信息的日志文件名称\n-d,--divisornumber#表示倍速播放,把时间日志文件记录的时间间隔都除以number\n#-d2表示播放速度是原始输入单条命令的速度的两倍,-d0.1表示播放单条命令的速度减慢10倍\n-m,--maxdelaynumber#表示命令之间的最大延迟时间(单位是秒)\n#-m2表示command.log中存放的两条命令之间的间隔时间如果大于两秒,则按两秒执行播放\n-V,--version#显示版本信息并退出\n-h,--help#显示帮助文本并退出\n参数

时间日志文件:存储时间日志信息的文件名称终端数据文件:存储终端数据信息的文件名称

scriptreplaytime.filecommand.log

scriptreplay-d1-m2-ttime.file-scommand.log记录终端内容到文件

[root@master1/tmp]#script-t2>time.file-a-fcommand.log\nScriptstarted,fileiscommand.log\n[root@master1/tmp]#cd/opt/ser^C\n[root@master1/tmp]#exit\nScriptdone,fileiscommand.log\n[root@master1/tmp]#\n[root@master1/tmp]#\n[root@master1/tmp]#\n[root@master1/tmp]#rm-rfcommand.logtime.file\n[root@master1/tmp]#script-t2>time.file-a-fcommand.log\nScriptstarted,fileiscommand.log\n[root@master1/tmp]#cd/opt/ansible/\n[root@master1/opt/ansible]#ll-ths\ntotal8.0K\n0drwxr-xr-x4rootroot75Jul1614:09chapt7\n0drwxr-xr-x3rootroot50Jul1613:29chapt6\n0drwxr-xr-x2rootroot230Jul1517:00chapt5\n4.0K-rw-r--r--1rootroot876Jul1510:51ssh-config.yaml\n0drwxr-xr-x10rootroot172Jul1508:40first_role\n4.0K-rw-r--r--1rootroot130Jul1215:45var.yaml\n[root@master1/opt/ansible]#catvar.yaml\n-hosts:k8s-master\nremote_user:root\ntasks:\n-name:createlogfile\nfile:name=/tmp/{{ansible_fqdn}}state=touch\n[root@master1/opt/ansible]#kubectltopnodes\nErrorfromserver(ServiceUnavailable):theserveriscurrentlyunabletohandletherequest(getnodes.metrics.k8s.io)\n[root@master1/opt/ansible]#kubectlgetpo-nnexus\n^C\n[root@master1/opt/ansible]#ok\nbash:ok:commandnotfound\n[root@master1/opt/ansible]#echobye\nbye\n\n

重新播放终端内容

[root@master1/tmp]#scriptreplay-d2-ttime.file-scommand.log\n[root@master1/tmp]#cd/opt/ansible/\n[root@master1/opt/ansible]#ll-ths\ntotal8.0K\n0drwxr-xr-x4rootroot75Jul1614:09chapt7\n0drwxr-xr-x3rootroot50Jul1613:29chapt6\n0drwxr-xr-x2rootroot230Jul1517:00chapt5\n4.0K-rw-r--r--1rootroot876Jul1510:51ssh-config.yaml\n0drwxr-xr-x10rootroot172Jul1508:40first_role\n4.0K-rw-r--r--1rootroot130Jul1215:45var.yaml\n[root@master1/opt/ansible]#catvar.yaml\n-hosts:k8s-master\nremote_user:root\ntasks:\n-name:createlogfile\nfile:name=/tmp/{{ansible_fqdn}}state=touch\n[root@master1/opt/ansible]#kubectltopnodes\nErrorfromserver(ServiceUnavailable):theserveriscurrentlyunabletohandletherequest(getnodes.metrics.k8s.io)\n[root@master1/opt/ansible]#kubectlgetpo-nnexus\n^C\n[root@master1/opt/ansible]#ok\nbash:ok:commandnotfound\n[root@master1/opt/ansible]#echobye\nbye\n\n注意点

其中,只有命令scriptreplay-d1-m2-ttime.file-scommand.log是用户输入,其他均为自动呈现(且视觉效果与真实用户的操作一致)。通过查看上面输出的时间2020-12-2320:48:46,可以证明,这是重新播放当时的记录,而非重新执行一遍命令。也就是说,可以把time.file和command.log文件移动到任意一台支持scriptreplay命令的机器上,都可以动态重现命令输入与终端回显。

好了,文章到此结束,希望可以帮助到大家。

本站涵盖的内容、图片、视频等数据,部分未能与原作者取得联系。若涉及版权问题,请及时通知我们并提供相关证明材料,我们将及时予以删除!谢谢大家的理解与支持!

Copyright © 2023