Mostrando entradas con la etiqueta comandos. Mostrar todas las entradas
Mostrando entradas con la etiqueta comandos. Mostrar todas las entradas

jueves, 2 de julio de 2009

cssh

En algunas ocasiones me es necesario tener sesiones simultaneas en maquinas distintas y ejecutar comando similares en todas las maquinas. Muchas veces me fue muy util crear un script con expect y ejecutarlo de manera que realmente no fuera interectiva mi sesion remota en los nodos.

Sin embargo, otras ocasiones tengo que hacer dichas sesiones interactivas y ademas deben ser de manera simultanea, la solucion: cssh

Mi archivo de configuracion: /etc/clusters


2 localhost localhost
3 localhost localhost localhost
4 localhost localhost localhost localhost
5 localhost localhost localhost localhost localhost
6 localhost localhost localhost localhost localhost localhost
7 localhost localhost localhost localhost localhost localhost localhost
8 localhost localhost localhost localhost localhost localhost localhost localhost
10 localhost localhost localhost localhost localhost localhost localhost localhost localhost localhost

PD: En debian el nombre del paquete es : clusterssh

miércoles, 1 de julio de 2009

Comandos...

Visitando la wikipedia vi una lista interesante los 60 comandos de usuario de la sección 1 de la Primera Edición de UNIX:

ar as b bas bcd boot cat chdir check chmod chown cmp cp date db dbppt dc df dsw dtf du ed find for form hup lbppt ld ln ls mail mesg mkdir mkfs mount mv nm od pr rew rkd rkf rkl rm rmdir roff sdate sh stat strip su sum tap tm tty type un wc who write

cuantos realmente se usar???

jueves, 17 de julio de 2008

Commands...

seq - print a sequence of numbers

local@debian:~$ for n in `seq 11 15`; do echo $n; done
11
12
13
14
15



split - split a file into pieces

local@debian:~$ ls -1 | split -5



watch - execute a program periodically, showing output fullscreen

local@debian:~$ watch -n 5 uptime

o

local@debian:~$ while sleep 5 ; do uptime ; done



pidof -- find the process ID of a running program.

local@debian:/bin$ pidof ssh
3875 3830 3822 3818 3815 3812 3809 3806





column - columnate lists


local@debian:/tmp$ ls | column -c 1
gconfd-local
keyring-TdbxsI
LDAP1.0_RT3.tar.gz
LDAP_RT3




stat - display file or file system status


local@debian:/tmp$ ls -l x
-rw-r--r-- 1 local local 135273 2008-08-11 16:41 x
local@debian:/tmp$ stat -c %a x
644



chattr - change file attributes on a Linux second extended file system


debian:/home2/local# chattr +i dir_inmutable

inmutable = root can't delete the file


lsattr - list file attributes on a Linux second extended file system


debian:/home2/local# lsattr -d dir_inmutable/
----i------------- dir_inmutable/


fdupes - finds duplicate files in a given set of directories

local@debian:~$ cp marcela_alegria.tex x.txt
local@debian:~$ fdupes .
./marcela_alegria.tex
./x.txt


Source: http://www.debian-administration.org/articles/605

[root@benito2 DPX]# netstat -tunlp

jueves, 20 de diciembre de 2007

Expect interactivo

Expect es genial para algunas actividades, pero en ocasiones se requiere que sea interactivo. Ejemplo:

#!/usr/bin/expect -f
#

set force_conservative 0 ;# set to 1 to force conservative mode
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}


set timeout 100
spawn ssh -l user1 [lindex $argv 0]
match_max 1000
for {} 1 {} {
expect timeout {
send_user "Problema de comunicacion \r"
exit
} "(yes/no)?" {
send "yes\r"
} "password:" {
send "mypassword\r"
break
}
}


expect -exact "\]$ "
send -- "Modo interactivo. Teclea 'salir' para continuar\n"
interact "salir" return
expect -exact "\]$ "
send -- "exit\r"
expect eof