function process_file {
file=$1
do_something_with $file
}
export -f process_file
find PATH -type f | xargs --max-args=1 --max-procs=NUM -I{} bash -c process_file \{\}
or a shorter version
find PATH -type f | xargs -n1 -PNUM -I{} bash -c process_file \{\}
Where NUM is the number of parallel jobs and PATH where to start looking for the files.
source
viernes, 18 de febrero de 2011
jueves, 10 de febrero de 2011
creando una postgres db en ramdisk
#ramdisk de 5GB
mount -o size=5G -t tmpfs tmpfs /mnt/ramdb
chown -R postgres.postgres /mnt/ramdb
#en postgres ahora
CREATE TABLESPACE ramdb LOCATION '/mnt/ramdb';
CREATE DATABASE db WITH TABLESPACE ramdb;
mount -o size=5G -t tmpfs tmpfs /mnt/ramdb
chown -R postgres.postgres /mnt/ramdb
#en postgres ahora
CREATE TABLESPACE ramdb LOCATION '/mnt/ramdb';
CREATE DATABASE db WITH TABLESPACE ramdb;
martes, 8 de febrero de 2011
Suscribirse a:
Entradas (Atom)