Test from shell script if remote TCP port is open - BASH

function check_net_port ()
local ip=$1
local port=$2
exec 3> /dev/tcp/"$ip"/"$port"
if [ $? -eq 0 ]; then return 0; else return 1; fi

HPUX - Convert VG from Legacy to Agile/persistent DSF

Create lvmtab backup file:

cp -p /etc/lvmtab /etc/lvmtab.`date +%y%m%d_%s`

Convert vg from legacy to Agile:

vgdsf -c /dev/

Check VG and lvmtab file:

vgdisplay -v /dev/
strings /etc/lvmtab


Linux - Howto recreate/restore PV/VG

Ohhhh.. I have lost the LVM metadata information on all my discs ... I lost all VG information .... vgscan , vgdisplay, pvscan, pvs, doesn't show any VG information! All disks are aviable on server and I can see It with multipath, but when I run pvscan/pvs, there's no LVM information on It.

May still have a hope of retrieving information from the PV / VG.

Run the procedure under their responsibility, the procedure described below could remove the entire contents of your VG.

Go to /etc/lvm/archiver/

cat from last copy from your vg file:


TCP/IP Access Using bash

When executing a command on a /dev/tcp/$host/$port pseudo-device file, Bash opens a TCP connection to the associated socket.

A socket is a communications node associated with a specific I/O port. (This is analogous to a hardware socket, or receptacle, for a connecting cable.) It permits data transfer between hardware devices on the same machine, between machines on the same network, between machines across different networks, and, of course, between machines at different locations on the Internet.

The following examples assume an active Internet connection.

Number of threads sorted by User

ps h -Led -o user | sort | uniq -c | sort -n


Linux - Find where inodes are being used

for i in *; do echo -e "$(find $i | wc -l)\t$i"; done | sort -n


Some large files in /var/opt/psb/db/pgsql/base/<directories> (HPUX 11.31, 11/09)

...seems like a bug in older SFM Versions.
To resolve this problem i've done the following steps:

1.) cimprovider -ls > /tmp/cimprovider_orig

2.) Stop psbdb

#/sbin/init.d/psbdb stop

3.) Delete the database.

#cd /var/opt/psb/db
#rm -r pgsql

4.) Reconfigure ProviderSvcsBase .

#swconfig -x reconfigure=true -x autoselect_dependencies=false ProviderSvcsBase

5.) Reconfigure SysFaultMgmt and all other providers that has its own database.


HPUX - Cambiar el número de PVs que acepta un VG en caliente.

Para cambiar el número de PVs que acepta un VG

1. Chequear a tabla de combinaciones de PV y max PE per PV que se pueden aplicar al VG. Esto lo conseguimos con el comando:

# vgmodify –v –t [VG_NAME]

Obtendrás una salida similar a:

Volume Group configuration for /dev/vgAPP_01 has been saved in /etc/lvmconf/vgAPP_01.conf

Current Volume Group settings:
Max LV 255
Max PV 16


HPUX - Recuperar permisos de un chmod -R chown -R

Este artículo explica como recuperar los permisos del sistema operativo HPUX con ignite tras ejecutar por accidente un chmod -R o un chown -R donde no toca, ejemplo chmod -R 400 /usr

Lo primero que hay que hacer es acojonarse y después ponerse manos a la obra.
Básicamente lo que haremos será extraer los permisos del ignite para montarnos un script que los reconstruya, con lo que es totalmente imprescindible tener una imagen de Ignite válida en el sistema operativo.

Vamos al directorio donde tenemos la imagen del servidor a recuperar los permisos:


HPUX - Encontrar procesos con un consumo alto de memória.

Para buscar los 10 procesos que consumen más de un sistema operativo HPUX:

UNIX95= ps -e -o pid,sz,pcpu,ruser,args|sort -nk2|tail -10



Subscribe to Badorius RSS