Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1738974
  • 博文数量: 220
  • 博客积分: 8531
  • 博客等级: 中将
  • 技术积分: 4971
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-18 13:33
文章分类

全部博文(220)

文章存档

2017年(1)

2015年(1)

2014年(5)

2013年(6)

2012年(6)

2011年(30)

2010年(37)

2009年(53)

2008年(41)

2007年(40)

分类: LINUX

2007-07-31 10:55:02

    在看到介绍OmniTTY,其称“ Linux系统管理员利器,重复劳动必备”,可以批量通过ssh登录多台linux机器,并且多台机器同时执行一样的命令。对于这个功能描述就很吸引人的,所以下来看看。
    OmniTTY:
    依赖:rote-0.2.8.tar.gz
    我下载的是当前最新版本omnitty-0.3.0.tar.gz,编译安装很正常:

[root@lvs191 tmp]# tar xvfz rote-0.2.8.tar.gz
rote-0.2.8/
rote-0.2.8/Makefile.in
rote-0.2.8/COPYING
rote-0.2.8/configure.ac
rote-0.2.8/README
rote-0.2.8/demo/
rote-0.2.8/demo/boxshell.c
rote-0.2.8/inject.c
rote-0.2.8/inject_csi.c
rote-0.2.8/inject_csi.h
rote-0.2.8/make-package.sh
rote-0.2.8/rote-config.in
rote-0.2.8/rote.c
rote-0.2.8/rote.h
rote-0.2.8/rote_keymap.c
rote-0.2.8/roteprivate.h
rote-0.2.8/configure
[root@lvs191 tmp]# tar xvfz omnitty-0.3.0.tar.gz
omnitty-0.3.0/
omnitty-0.3.0/Makefile.in
omnitty-0.3.0/COPYING
omnitty-0.3.0/configure.ac
omnitty-0.3.0/README
omnitty-0.3.0/curutil.c
omnitty-0.3.0/curutil.h
omnitty-0.3.0/help.c
omnitty-0.3.0/help.h
omnitty-0.3.0/machine.c
omnitty-0.3.0/machine.h
omnitty-0.3.0/machmgr.c
omnitty-0.3.0/machmgr.h
omnitty-0.3.0/main.c
omnitty-0.3.0/make-package.sh
omnitty-0.3.0/menu.c
omnitty-0.3.0/menu.h
omnitty-0.3.0/minibuf.c
omnitty-0.3.0/minibuf.h
omnitty-0.3.0/omnitty.1
omnitty-0.3.0/TODO
omnitty-0.3.0/CHANGELOG
omnitty-0.3.0/configure
[root@lvs191 tmp]# cd rote-0.2.8
[root@lvs191 rote-0.2.8]# ./configure
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for sys/types.h... (cached) yes
checking for unistd.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for initscr in -lncurses... yes
checking for forkpty in -lutil... yes
checking for memset... yes
checking for select... yes
checking for setenv... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking types of arguments for select... int,fd_set *,struct timeval *
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
checking for inline... inline
checking for pid_t... yes
checking return type of signal handlers... void
configure: creating ./config.status
config.status: creating Makefile
config.status: creating rote-config
[root@lvs191 rote-0.2.8]# make
gcc -g -O2 -Wall -fPIC -MM inject.c inject_csi.c rote.c rote_keymap.c >.depends
gcc -g -O2 -Wall -fPIC   -c -o inject.o inject.c
gcc -g -O2 -Wall -fPIC   -c -o inject_csi.o inject_csi.c
gcc -g -O2 -Wall -fPIC   -c -o rote.o rote.c
gcc -g -O2 -Wall -fPIC   -c -o rote_keymap.o rote_keymap.c
gcc -g -O2 -Wall -fPIC -shared -o librote.so.0.2.8 -Wl,-soname=librote.so.0 inject.o inject_csi.o rote.o rote_keymap.o  -lutil -lncurses
[root@lvs191 rote-0.2.8]# make install
mkdir -p /usr/local/include/rote
rm -f /usr/local/include/rote/*.h
cp rote.h /usr/local/include/rote
mkdir -p /usr/local/lib
cp librote.so.0.2.8 /usr/local/lib
cd /usr/local/lib && ln -sf librote.so.0.2.8 librote.so
cd /usr/local/lib && ln -sf librote.so.0.2.8 librote.so.0
chmod 755 rote-config
mkdir -p /usr/local/bin
cp -p rote-config /usr/local/bin
-----------------------------------------------------------
ROTE - Our Own Terminal Emulation Library v0.2.8

Include files installed at: /usr/local/include
Library files installed at: /usr/local/lib
rote-config executable    : /usr/local/bin/rote-config

To find out what compiler arguments you should use to
compile programs that use rote, use the rote-config
program (make sure /usr/local/bin is in your path).
-----------------------------------------------------------
[root@lvs191 rote-0.2.8]# cd ../omnitty-0.3.0
[root@lvs191 omnitty-0.3.0]# ./configure
checking whether libROTE is installed... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for an ANSI C-conforming const... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for pid_t... yes
checking return type of signal handlers... void
checking for strdup... yes
configure: creating ./config.status
config.status: creating Makefile
[root@lvs191 omnitty-0.3.0]# make
gcc -g -O2 -I/usr/local/include -Wall -DOMNITTY_VERSION=\"0.3.0\" -MM curutil.c help.c machine.c machmgr.c main.c menu.c minibuf.c >.depends
gcc -g -O2 -I/usr/local/include -Wall -DOMNITTY_VERSION=\"0.3.0\"   -c -o curutil.o curutil.c
gcc -g -O2 -I/usr/local/include -Wall -DOMNITTY_VERSION=\"0.3.0\"   -c -o help.o help.c
gcc -g -O2 -I/usr/local/include -Wall -DOMNITTY_VERSION=\"0.3.0\"   -c -o machine.o machine.c
gcc -g -O2 -I/usr/local/include -Wall -DOMNITTY_VERSION=\"0.3.0\"   -c -o machmgr.o machmgr.c
gcc -g -O2 -I/usr/local/include -Wall -DOMNITTY_VERSION=\"0.3.0\"   -c -o main.o main.c
gcc -g -O2 -I/usr/local/include -Wall -DOMNITTY_VERSION=\"0.3.0\"   -c -o menu.o menu.c
gcc -g -O2 -I/usr/local/include -Wall -DOMNITTY_VERSION=\"0.3.0\"   -c -o minibuf.o minibuf.c
gcc -g -O2 -I/usr/local/include -Wall -DOMNITTY_VERSION=\"0.3.0\" -o omnitty curutil.o help.o machine.o machmgr.o main.o menu.o minibuf.o  -L/usr/local/lib -lrote
[root@lvs191 omnitty-0.3.0]# make install
mkdir -p /usr/local/bin
cp omnitty /usr/local/bin
mkdir -p /usr/local/man/man1
cp omnitty.1 /usr/local/man/man1
[root@lvs191 ~]# omnitty
omnitty: error while loading shared libraries: librote.so.0: cannot open shared object file: No such file or directory
[root@lvs191 ~]# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/lib/rfmin/lib
/usr/lib/icc
/usr/local/lib
[root@lvs191 ~]# exec ldconfig   <碰到很多次了,命令库文件在搜索目录里面,但是不生效,只能强制让他生效>


    现在可以启动omnitty了。


    omnitty的用法还是比较郁闷的,首先F5添加一个主机,添加类似如下“root@172.16.81.191”,然后让你输入密码,登录之后再添加第二个主机,继续添加第n个主机。添加完毕之后,假设有17个主机,可以按F2、F3上下选择不同的主机,在每个主机上面做不同的操作。
    如果想批量,在所有主机上都做一个操作,必须按F1,打开菜单,按t选中所有的活动主机,然后按F7启动批量操作功能(右瞎角红色闪烁!!! MULTICAST MODE !!!),这时候,你的操作在所有机器上都起作用。可以F2/F3上下切换看看效果。
    这个工具还是有很多缺点的:不能保存主机列表(左侧是主机列表),下次启动必须再挨个F5添加;如果链接断了,不能再登录了,只能删除重添加才能登录。有待完善的太多了。
阅读(2036) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~