菜单

15源码安装,Linux中通过script命令那个记录屏幕的输出

2019年8月2日 - 4166m金沙

[root@localhost ~]# script -f screen.log
Script started, file is screen.log
[root@localhost ~]# ls -ltr
total 33548
-rw-r–r– 1 root root 15981 Jan 10 2008 server.met0
-rw-r–r– 1 root root 9347 Mar 17 2008 install.log.syslog
-rw-r–r– 1 root root 53792 Mar 17 2008 install.log
drwxr-xr-x 2 root root 4096 Jun 5 20:17 result
drwxr-xr-x 2 root root 4096 Jun 6 20:12 little
drwxr-xr-x 2 root root 4096 Jun 6 22:35 2little
drwxr-xr-x 2 root root 4096 Jun 6 23:04 big
-rw-r–r– 1 root root 1079120 Jun 18 15:25 test.cap
drwxr-xr-x 5 root root 4096 Jun 30 12:43 Final
-rw-r–r– 1 root root 805 Jul 2 20:15 Parser.h
-rw-r–r– 1 root root 855 Jul 2 20:29 HttpDownloader.h
-rw-r–r– 1 root root 2997 Jul 3 08:37 Parser.cpp
-rw-r–r– 1 root root 2770 Jul 3 08:39 HttpDownloader.cpp
-rw-r–r– 1 root root 32 Jul 28 16:21 HarmKeyWord.ini
-rw-r–r– 1 root root 822 Jul 29 15:35 queue.cap
-rw-r–r– 1 root root 3112 Oct 13 20:44 manscript
-rw-r–r– 1 root root 79 Oct 13 20:47 screen.log
[root@localhost ~]# sdf
bash: sdf: command not found
[root@localhost ~]#
[root@localhost ~]# w
20:48:14 up 5 days, 4:29, 3 users, load average: 6.15, 2.60, 1.49
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/1 172.16.15.111 19:36 54:33 0.05s 0.05s -bash
root pts/3 172.16.13.134 20:44 35.00s 0.03s 0.00s tail -f screen.
root pts/5 172.16.13.134 20:28 0.00s 0.02s 0.00s script -f scree
[root@localhost ~]# exit
exit

[root@localhost bin]# pwd

env.user=’root’

一旦在首先个终端上运用mkfifo screen.log(一般不要那些命令)和下令script -f
screen.log。在其它一个极端找到那一个screen.log文件,用tail -f
screen.log就能够实时滚动输出你在首先个终端的出口。

   1:libaio-devel          
###########################################
[100%]

[192.168.0.9] run: ls -al
/home

-f选项的情致正是只有当缓冲区满后技术在其它三个巅峰展现前壹回缓冲区满的从头到尾的经过。即便是非凡退出也并没不日常,仍旧能够通常记录log,用命令script
-f screen.log就足以了。

Preparing…               
###########################################
[100%]

[192.168.0.9] out:
drwxr-xr-x 2 zhf zhf 4096 Jul 9 14:35 Pictures

先是个窗口:

# ./scripts/mysql_install_db –user=mysql –datadir=/var/lib/mysql

[192.168.0.9] out:
-rw——- 1 zhf zhf 64 Nov 1 21:04 .Xauthority

[root@localhost ~]# tail -f screen.log
Script started on Mon 13 Oct 2008 08:47:29 PM CST
[root@localhost ~]# ls -ltr
total 33548
-rw-r–r– 1 root root 15981 Jan 10 2008 server.met0
-rw-r–r– 1 root root 9347 Mar 17 2008 install.log.syslog
-rw-r–r– 1 root root 53792 Mar 17 2008 install.log
drwxr-xr-x 2 root root 4096 Jun 5 20:17 result
drwxr-xr-x 2 root root 4096 Jun 6 20:12 little
drwxr-xr-x 2 root root 4096 Jun 6 22:35 2little
drwxr-xr-x 2 root root 4096 Jun 6 23:04 big
-rw-r–r– 1 root root 1079120 Jun 18 15:25 test.cap
drwxr-xr-x 5 root root 4096 Jun 30 12:43 Final
-rw-r–r– 1 root root 805 Jul 2 20:15 Parser.h
-rw-r–r– 1 root root 855 Jul 2 20:29 HttpDownloader.h
-rw-r–r– 1 root root 2997 Jul 3 08:37 Parser.cpp
-rw-r–r– 1 root root 2770 Jul 3 08:39 HttpDownloader.cpp
-rw-r–r– 1 root root 32 Jul 28 16:21 HarmKeyWord.ini
-rw-r–r– 1 root root 822 Jul 29 15:35 queue.cap
-rw-r–r– 1 root root 3112 Oct 13 20:44 manscript
-rw-r–r– 1 root root 79 Oct 13 20:47 screen.log
[root@localhost ~]# sdf
bash: sdf: command not found
[root@localhost ~]#
[root@localhost ~]# w
20:48:14 up 5 days, 4:29, 3 users, load average: 6.15, 2.60, 1.49
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/1 172.16.15.111 19:36 54:33 0.05s 0.05s -bash
root pts/3 172.16.13.134 20:44 35.00s 0.03s 0.00s tail -f screen.
root pts/5 172.16.13.134 20:28 0.00s 0.02s 0.00s script -f scree
[root@localhost ~]# exit
exit

 

[192.168.0.9] out:

[root@localhost ~]#

# chkconfig –add mysqld

[192.168.0.9] out:
-rw-r–r– 1 zhf zhf 675 Jul 2 16:44 .profile

其次个窗口:

[root@localhost rpm]# ll /usr/local/cmake/

with cd(“/home/zhf”):
#with的成效是让前面包车型地铁表明式的话语集成当前地方达成cd /home/zhf && ls
-al的功效

[root@localhost ~]#

drwxr-xr-x 3 root root 4096 Jun 30 12:37 doc

法布里c是依靠Python完结的SSH命令行工具。能够应用命令行的格局来试行SSH。可以觉得是在paramiko的功底上做了更加高级中学一年级层的包装。来看下如何运用。

由此那么些格局,也足以用于教学其中,老师通过script命令记录操作日志,学员通过tail
-f命令实时查看老师批注意况。

root@localhost ~]# vi .bash_profile 

然后再依照如下情势的行使。能够见到远程连接成功。

Script done on Mon 13 Oct 2008 08:48:23 PM CST

-DWITH_PARTITION_STORAGE_ENGINE=1 \

[192.168.0.9] out:
-rw-rw-r– 1 zhf zhf 60638465 Oct 18 2013
VMwareTools-9.6.1-1378637.tar.gz

我们用script来记录显示屏的输出,这一个是在Linux的平台下采纳的,Solaris和AIX中script命令未有-f选项。

[root@localhost rpm]# rpm -ivh bison-2.3-2.1.x86_64.rpm

run(“ls -al
“+dirname)

Script done on Mon 13 Oct 2008 08:48:23 PM CST

Preparing…               
###########################################
[100%]

[192.168.0.9] Executing
task ‘go’

图片 1

[root@localhost rpm]# rpm -ivh libaio-devel-0.3.106-5.x86_64.rpm

[192.168.0.9] out:
-rw——- 1 zhf zhf 354 Nov 1 21:04
.xsession-errors

比如未有-f正是唯有当缓冲区满了后技艺在其它七个终端呈现前一回缓冲区满的原委。

-DDEFAULT_CHARSET=utf8 \

[192.168.0.9] out:
-rw-r–r– 1 zhf zhf 8980 Jul 2 16:44
examples.desktop

[root@localhost rpm]# rpm -ivh
ncurses-devel-5.5-24.20060715.x86_64.rpm

咱俩未来就来编排fabfiles.

[root@localhost Percona-Server-5.5.15-rel21.0]# make && make install

Done.

-rw-r–r–  1 root root 17987 Jul 13  2011 COPYING

Fab的参数如下:

Preparing…               
###########################################
[100%]

实行效果如下

Preparing…               
###########################################
[100%]

[192.168.0.9] out:
-rw-r–r– 1 zhf zhf 3760 Jul 2 16:44 .bashrc

warning: perl-5.8.8-27.el5.x86_64.rpm: Header V3 DSA signature: NOKEY,
key ID 37017186

worktask(getdirname)
#实施命令

warning: bison-2.3-2.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key
ID 37017186

confirm:得到提示音信确认

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

Disconnecting from
192.168.0.9… done.

[root@localhost mysql]#

[192.168.0.9] out:
drwxr-xr-x 7 zhf zhf 4096 Oct 18 2013
vmware-tools-distrib

warning: gcc-c++-4.1.2-48.el5.x86_64.rpm: Header V3 DSA signature:
NOKEY, key ID 37017186

Available
commands:

/usr/local/src/Percona-Server-5.5.15-rel21.0

[192.168.0.9] out:
drwx—— 17 zhf zhf 4096 Jul 26 10:49 .config

drwxr-xr-x 27 root root  4096 Jun 30 12:57 share

[192.168.0.9] out:
drwxr-xr-x 2 zhf zhf 4096 Jul 2 17:51 下载

tar zxvf cmake-2.8.7.tar.gz

[192.168.0.9] out:
drwx—— 2 zhf zhf 4096 Oct 27 23:05 .ssh

[root@localhost bin]# ll

第一是全局属性设定:evn
evn对象的机能是定义fabrile的大局设定。协助五性情子,包蕴目的主机,用户,密码,脚色等。来看上边包车型大巴例子。首先通过env设置用户以及远程主机IP

Mysql5.5后透过cmake来编写翻译,cmake-2.8.12.2.tar.gz 所以需求下载安装

run:实施远程命令

-rw-r–r– 1 root root  1790863 Jan 18  2007
ncurses-devel-5.5-24.20060715.x86_64.rpm

root@zhf-linux:/home/zhf/zhf/python_prj/auto_manintance#
fab -f chapter7.py remote_task

-DWITH_MYISAM_STORAGE_ENGINE=1 \

put:上传文件到长途主机

[root@localhost Percona-Server-5.5.15-rel21.0]#cmake \

[192.168.0.9] out: total
68

-rw-r–r– 1 root root 12771327 Jul 13  2009
perl-5.8.8-27.el5.x86_64.rpm

[192.168.0.9] out:
drwx—— 3 zhf zhf 4096 Jul 9 09:19 .dbus

drwxr-xr-x  2 root root  4096 Jun 30 12:57 docs

[192.168.0.9] out:
drwx—— 4 root root 4096 Jul 26 10:47 .config

Preparing…               
###########################################
[100%]

[192.168.0.9] out:
drwxr-xr-x 2 zhf zhf 4096 Jul 9 14:35 Documents

total 16

上边来看下fabfile的编写:

 

[192.168.0.9] out:
-rw-r–r– 1 root root 12376 Oct 29 21:21
syslogin.log

warning: libaio-devel-0.3.106-5.x86_64.rpm: Header V3 DSA signature:
NOKEY, key ID 37017186

Aborting

# cp support-files/mysql.server /etc/init.d/mysqld

env.hosts=[‘192.168.0.9’]

 

root@zhf-linux:/home/zhf/zhf/python_prj/auto_manintance#
fab -H 192.168.0.9 — ‘ls -al’

drwxr-xr-x 2 root root 4096 Jun 30 12:37 bin

[192.168.0.9] out:
drwxr-xr-x 2 zhf zhf 4096 Jul 9 14:35 Public

 

[192.168.0.9] out:
drwxr-xr-x 2 root root 4096 Oct 30 21:18 .rpmdb

total 76

-T:设置远程主机命令实行超时时间

# service mysql start

def
go():

[root@localhost Percona-Server-5.5.15-rel21.0]# pwd

[192.168.0.9] out:

-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \

[192.168.0.9] out:
-rw-r–r– 1 zhf zhf 220 Jul 2 16:44 .bash_logout

-DEXTRA_CHARSETS=all \

[192.168.0.9] out: total
2664

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图