mv /etc/vmware/license.cfg /etc/vmware/license.cfg.05-12-2014
cp /etc/vmware/.#license.cfg /etc/vmware/license.cfg
/etc/init.d/vpxa restart
restart el VMware server
mv /etc/vmware/license.cfg /etc/vmware/license.cfg.05-12-2014
cp /etc/vmware/.#license.cfg /etc/vmware/license.cfg
/etc/init.d/vpxa restart
#!/opt/csw/bin/expect -f
set timeout -1
spawn /usr/local/apps/informix/bin/ontape -r
expect "Please mount tape 1 on /ruta/de/informix/bkp.full and press Return to continue ..."
send -- "\r"
expect "Continue restore? (y/n)"
send -- "y\r"
expect "Do you want to back up the logs? (y/n)"
send -- "n\r"
expect "Restore a level 1 archive (y/n)"
send -- "n\r"
expect "Do you want to restore log tapes? (y/n)"
send -- "n\r"
expect eof
server pkg# expect
-bash: /usr/local/bin/expect: Invalid argument
server pkg# /opt/csw/bin/pkgutil -a expect
=> Fetching new catalog and descriptions (http://mirror.opencsw.org/opencsw/testing/i386/5.10) if available ...
==> 3612 packages loaded from /var/opt/csw/pkgutil/catalog.mirror.opencsw.org_opencsw_testing_i386_5.10
common package catalog size
expect CSWexpect 5.45,REV=2013.04.10 218.6 KB
pm_expect CSWpm-expect 1.21,REV=2013.08.18 49.7 KB
pm_expect_simple CSWpm-expect-simple 0.04,REV=2013.08.18 14.3 KB
py_pexpect CSWpy-pexpect 2.3,REV=2013.09.10 68.0 KB
server pkg# /opt/csw/bin/pkgutil -i CSWexpect
Solving needed dependencies ...
Solving dependency order ...
1 CURRENT packages:
CSWcommon-1.5,REV=2010.12.11
Install 4 NEW packages:
CSWexpect-5.45,REV=2013.04.10 (opencsw/testing)
CSWlibtcl8-5-8.5.15,REV=2013.10.09 (opencsw/testing)
CSWsunmath-2007.08.04 (opencsw/testing)
CSWtcl8-tclmodules-8.5.15,REV=2013.10.09 (opencsw/testing)
Total size: 2.2 MB
4 packages to fetch. Do you want to continue? ([y],n,auto)
=> Fetching CSWsunmath-2007.08.04 (1/4) ...
=> Fetching CSWtcl8-tclmodules-8.5.15,REV=2013.10.09 (2/4) ...
...
...
Installation ofwas successful.
server pkg# /opt/csw/bin/expect
root@Server:~# vi /etc/apt/sources.list
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
root@Server:~# apt-get update
....
Reading package lists... Done
W: GPG error: http://webmin.mirror.somersettechsolutions.co.uk sarge Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D97A3AE911F63C51
W: GPG error: http://download.webmin.com sarge Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D97A3AE911F63C51
....
root@Server:~# cd /root
root@Server:~# wget http://www.webmin.com/jcameron-key.asc
--2014-10-20 12:01:48-- http://www.webmin.com/jcameron-key.asc
Resolving www.webmin.com (www.webmin.com)... 216.34.181.97
Connecting to www.webmin.com (www.webmin.com)|216.34.181.97|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1320 (1.3K) [text/plain]
Saving to: `jcameron-key.asc'
100%[=======================================================================================================================================>] 1,320 --.-K/s in 0s
2014-10-20 12:01:48 (71.9 MB/s) - `jcameron-key.asc' saved [1320/1320]
root@Server:~# apt-key add jcameron-key.asc
OK
root@Server:~# apt-get update
Get:1 http://ftp.ccc.uba.ar wheezy Release.gpg [1,655 B]
Get:2 http://ftp.ccc.uba.ar wheezy-updates Release.gpg [836 B]
Get:3 http://ftp.ccc.uba.ar wheezy Release [168 kB]
Get:4 http://ftp.ccc.uba.ar wheezy-updates Release [124 kB]
Get:5 http://ftp.ccc.uba.ar wheezy/main Sources [5,955 kB]
Get:6 http://download.webmin.com sarge Release.gpg [189 B]
Hit http://security.debian.org wheezy/updates Release.gpg
Get:7 http://webmin.mirror.somersettechsolutions.co.uk sarge Release.gpg [189 B]
Hit http://security.debian.org wheezy/updates Release
Hit http://webmin.mirror.somersettechsolutions.co.uk sarge Release
Hit http://download.webmin.com sarge Release
Hit http://webmin.mirror.somersettechsolutions.co.uk sarge/contrib amd64 Packages
Hit http://download.webmin.com sarge/contrib amd64 Packages
Hit http://security.debian.org wheezy/updates/main Sources
Hit http://security.debian.org wheezy/updates/main amd64 Packages
Hit http://security.debian.org wheezy/updates/main Translation-en
Ign http://webmin.mirror.somersettechsolutions.co.uk sarge/contrib Translation-en_US
Ign http://webmin.mirror.somersettechsolutions.co.uk sarge/contrib Translation-en
Ign http://download.webmin.com sarge/contrib Translation-en_US
Ign http://download.webmin.com sarge/contrib Translation-en
Get:8 http://ftp.ccc.uba.ar wheezy/main amd64 Packages [5,841 kB]
Get:9 http://ftp.ccc.uba.ar wheezy/main Translation-en [3,846 kB]
Get:10 http://ftp.ccc.uba.ar wheezy-updates/main Sources [14 B]
Get:11 http://ftp.ccc.uba.ar wheezy-updates/main amd64 Packages/DiffIndex [1,609 B]
Get:12 http://ftp.ccc.uba.ar wheezy-updates/main Translation-en/DiffIndex [1,057 B]
Fetched 15.9 MB in 25s (620 kB/s)
Reading package lists... Done
root@Server:~#
root@Server:~# apt-get install webmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libdbi-perl libodbc1
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
apt-show-versions libapt-pkg-perl libauthen-pam-perl libio-pty-perl
The following NEW packages will be installed:
apt-show-versions libapt-pkg-perl libauthen-pam-perl libio-pty-perl webmin
0 upgraded, 5 newly installed, 0 to remove and 22 not upgraded.
Need to get 22.1 MB of archives.
After this operation, 141 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://ftp.ccc.uba.ar/pub/linux/debian/debian/ wheezy/main libauthen-pam-perl amd64 0.16-2+b2 [31.3 kB]
Get:2 http://ftp.ccc.uba.ar/pub/linux/debian/debian/ wheezy/main libio-pty-perl amd64 1:1.08-1+b2 [40.0 kB]
Get:3 http://ftp.ccc.uba.ar/pub/linux/debian/debian/ wheezy/main libapt-pkg-perl amd64 0.1.26+b1 [84.7 kB]
1% [Connecting to download.webmin.com]
Get:4 http://ftp.ccc.uba.ar/pub/linux/debian/debian/ wheezy/main apt-show-versions all 0.20 [34.9 kB]
Get:5 http://download.webmin.com/download/repository/ sarge/contrib webmin all 1.710 [21.9 MB]
Fetched 22.1 MB in 1min 16s (288 kB/s)
Selecting previously unselected package libauthen-pam-perl.
(Reading database ... 45191 files and directories currently installed.)
Unpacking libauthen-pam-perl (from .../libauthen-pam-perl_0.16-2+b2_amd64.deb) ...
Selecting previously unselected package libio-pty-perl.
Unpacking libio-pty-perl (from .../libio-pty-perl_1%3a1.08-1+b2_amd64.deb) ...
Selecting previously unselected package libapt-pkg-perl.
Unpacking libapt-pkg-perl (from .../libapt-pkg-perl_0.1.26+b1_amd64.deb) ...
Selecting previously unselected package apt-show-versions.
Unpacking apt-show-versions (from .../apt-show-versions_0.20_all.deb) ...
Selecting previously unselected package webmin.
Unpacking webmin (from .../archives/webmin_1.710_all.deb) ...
Processing triggers for man-db ...
Setting up libauthen-pam-perl (0.16-2+b2) ...
Setting up libio-pty-perl (1:1.08-1+b2) ...
Setting up libapt-pkg-perl (0.1.26+b1) ...
Setting up apt-show-versions (0.20) ...
** initializing cache. This may take a while **
Setting up webmin (1.710) ...
Webmin install complete. You can now login to https://Server:10000/
as root with your root password, or as any user who can use sudo
to run commands as root.
#!/bin/bashecho "Verifico el tamaño del archivo local:"VAR1=`du -sk /ruta/al/archivo`echo "Copiando el archivo al servidor remoto:"scp /ruta/al/archivo server:/ruta/remota/al/archivoecho "Verifico el tamaño del archivo remoto:"VAR2=`ssh server du -sk /ruta/remota/al/archivo`echo "Verifico el md5 del archivo local:"VAR3=`digest -v -a md5 /ruta/al/archivo | cut -d "=" -f2`echo "Verifico el md5 del archivo remoto"VAR4=`ssh server digest -v -a md5 /ruta/al/archivo | cut -d "=" -f2`if [ "$VAR1" = "$VAR2" ];thenecho "Tamanos iguales."elseecho "Tamano incorrecto - Copia incorrecta !!"fiif [ "$VAR3" = "$VAR4" ];thenecho "Hashes iguales."echo "La copia ha finalizado correctamente."elseecho "Tamano incorrecto - Copia incorrecta !!"fi
UX: useradd: ERROR: Inconsistent password files. See pwconv(1M).
# pwconv
# cd /
# touch /forcefsck
# reboot
# fsck /dev/sda1
C:\VM\RegisterBEVMPlugin.exe -r -s VcenterServer -m http://Webserver/ruta/RegisterBEVMPlugin.exe
ServerBalance# vi /var/www/index.html
< html>
< FORM ACTION="/cgi-bin/index.cgi">
< /html>
ServerBalance# vi /etc/apache2/sites-available/default
....
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
....
ServerBalance# /etc/init.d/apache2 reload
ServerBalance# vi /usr/lib/cgi-bin/redirect.pl
#!/usr/bin/perl
$lower_limit = 1;
$upper_limit = 3;
my $random_number = int(rand($upper_limit-$lower_limit)) + $lower_limit;
if ($random_number == 1)
{
$result = `nmap -sT -P0 server01 -p 80|grep open`;
if ($? == 0)
{
print "Location: http://server01:80/app\n\n";
}
else
{
print "Location: http://server02:80/app\n\n";
}
}
else
{
$result = `nmap -sT -P0 server02 -p 80|grep open`;
if ($? == 0)
{
print "Location: http://server02:80/app\n\n";
}
else
{
print "Location: http://server01:80/app\n\n";
}
}
[root@server~]# cat /etc/hosts|grep dominio
192.168.0.1 mi.dominio.net server_ad
[root@server~]# vi /ruta/del/apache/conf/extra/nagios.conf
ScriptAlias /nagios/cgi-bin "/ruta/del/nagios/nagios/sbin"
AuthBasicProvider ldap
AuthType Basic
AuthName "Auth Active Directory"
AuthLDAPURL "ldap://mi.dominio.net:389/DC=mi,DC=dominio,DC=net?sAMAccountName?sub?(objectClass=user)" NONE
AuthLDAPBindDN "usuario@mi.dominio.net"
AuthLDAPBindPassword "ACA VA EL PASSWORD DEL USER DE ARRIBA"
require ldap-attribute objectClass=user
Alias /nagios "/ruta/del/nagios/nagios/share"
AuthBasicProvider ldap
AuthType Basic
AuthName "Auth Active Directory"
AuthLDAPURL "ldap://mi.dominio.net:389/DC=mi,DC=dominio,DC=net?sAMAccountName?sub?(objectClass=user)" NONE
AuthLDAPBindDN "usuario@mi.dominio.net"
AuthLDAPBindPassword "ACA VA EL PASSWORD DEL USER DE ARRIBA"
require ldap-attribute objectClass=user
[root@server~]# /etc/init.d/httpd stop
[root@server~]# /etc/init.d/httpd start
[root@Server~]# vi /ruta/del/nagios/etc/cgi.cfg
authorized_for_system_information=admin,usuario .....
[root@Server~]# /ruta/del/nagios/bin/nagios -v /ruta/del/nagios/etc/nagios.cfg
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
[root@Server~]# /etc/init.d/nagios reload
Running configuration check...done.
Reloading nagios configuration...done
root@Server# /boot/grub/bin/grub
grub>
grub> md5crypt
GNU GRUB version 0.97 (640K lower / 65536K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
Password: *************
Encrypted: $2$h1mitk$IvvwH7S1nd3KhyTYCU92/
grub> quit
root@Server # cp -pf /boot/grub/menu.lst /boot/grub/menu.lst.bkp
root@Server # vi /boot/grub/menu.lst
password --md5 $2$h1mitk$IvvwH7S1nd3KhyTYCU92/
password --md5 $2$h1mitk$IvvwH7S1nd3KhyTYCU92/
#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title Oracle Solaris 10 1/13 s10x_u11wos_24a X86
lock
findroot (rootfs0,0,a)
kernel /platform/i86pc/multiboot
module /platform/i86pc/boot_archive
#---------------------END BOOTADM--------------------
#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title Solaris failsafe
lock
findroot (rootfs0,0,a)
kernel /boot/multiboot -s
module /boot/amd64/x86.miniroot-safe
#---------------------END BOOTADM--------------------
root@server # ps -el |grep 'Z'
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
root@server #
root@server # vi zombie.c
#include
#include
#include
int main ()
{
pid_t child_pid;
child_pid = fork ();
if (child_pid > 0) {
sleep (60);
}
else {
exit (0);
}
return 0;
}
root@server # /usr/sfw/bin/gcc zombie.c
root@server # ./a.out
root@server # ps -el |grep 'Z'
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 Z 0 17100 17099 0 0 - - 0 - ? 0:00
root@server #
root@server # vi check_zombie
#!/bin/bash
CANT_ZOMBIES=`ps -el |grep 'Z'|grep -v PPID|wc -l`
#echo $CANT_ZOMBIES
if [ $CANT_ZOMBIES -eq 0 ]
then
echo "$CANT_ZOMBIES Zombies"
exit 0
fi
if [ $CANT_ZOMBIES -eq 1 ]
then
echo "$CANT_ZOMBIES Zombies"
exit 1
fi
echo "$CANT_ZOMBIES Zombies"
exit 2
root@server # vi /usr/local/nagios/etc/nrpe.cfg
command[check_zombie_procs]=/usr/local/nagios/libexec/check_zombie
root@server # ps -efa |grep nrpe
nagios 18369 1 0 13:02:52 ? 0:00 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
root 18543 15868 0 13:06:54 pts/1 0:00 grep nrpe
root@server # kill -9 18369
root@server # /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
%!xxd