免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1827 | 回复: 0
打印 上一主题 下一主题

OmniTTY 批量ssh登录操作 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-07-31 10:55 |只看该作者 |倒序浏览
    在
http://baoz.net
看到介绍OmniTTY,其称“
      Linux系统管理员利器,重复劳动必备”,可以批量通过ssh登录多台linux机器,并且多台机器同时执行一样的命令。对于这个功能描述就很吸引人的,所以下来看看。
    OmniTTY:http://omnitty.sourceforge.net/
    依赖: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添加;如果链接断了,不能再登录了,只能删除重添加才能登录。有待完善的太多了。


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/43502/showart_350645.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP