sexta-feira, 26 de abril de 2013

Curl download FTP [Linux]

curl --ftp-pasv -v -O "ftp://usuario:senha@xxx.xxx.xxx.xxx/arquivo.hmi"

quarta-feira, 17 de abril de 2013

Linux Brigde (Switch) [Linux]

CRIAÇÃO DE BRIDGE NO LINUX

ip addr flush dev eth1
ip addr flush dev eth2
brctl addbr br0
brctl addif br0 eth1
brctl addif br0 eth2
ip link set br0 up
ip link set eth1 up
ip link set eth2 up
ip addr add xxx.xxx.xxx.xxx(interface 1)/24 dev br0
ip addr add xxx.xxx.xxx.xxx(interface 2)/24 dev br0
ip route add default via xxx.xxx.xxx.xxx(gateway)

____________________________________________________

USANDO IPTABLES EM BRIDGE

terça-feira, 16 de abril de 2013

Associar aplicativo a extensão [Linux]

The file manager (Nautilus, by default) uses the MIME type of a file to determine which program to open it with. When an application is installed, it can specify what MIME types it can open and the command to use to open the files in the .desktop file which is placed in /usr/share/applications. This is the file used for menus, desktop shortcuts, etc.

segunda-feira, 25 de fevereiro de 2013

How to log Postgres SQL queries [Linux]

1) Criar diretório 'pg_log' com permissão de proprietário e grupo para 'postgres'

#cd /usr/local/pgsql/data
#mkdir pg_log
#chown postgres.postgres pg_log

2) Alterar os parâmetros abaixo no arquivo postgresql.conf:
Descomentar a linha:

#log_destination = 'stderr'
#redirect_stderr = off #Alterar o valor para ON
#log_directory = 'pg_log'
#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
#log_rotation_size = 10240
#log_statement = 'none' #Alterar o valor para 'all'


OBS.:


redirect_stderr was renamed to logging_collector in version 8.3.

terça-feira, 5 de fevereiro de 2013

quinta-feira, 24 de janeiro de 2013

Testar o link remotamente pelo SSH

curl -o /dev/null --proxy http://10.202.170.1:3128 http://speedtest.wdc01.softlayer.com/downloads/test500.zip

quarta-feira, 23 de janeiro de 2013

CROSS JOIN, UNION ALL SQL [Linux]

CROSS JOIN (Juntar ou cruzar tabelas com chaves iguais), UNION ALL (Unir em unico resultado, no exemplo abaixo uniu o cross1 e cross2)

select uf,datahora,nomepcd from pcdmet cross join gestpcd_2 where pcdmet.nomepcd=32766 and gestpcd_2.id=32766 and datahora between '1996-03-11 00:00:00' and '1996-03-11 23:59:59' UNION all select uf,datahora,nomepcd from pcdmet_2003_96 cross join gestpcd_2 where pcdmet_2003_96.nomepcd=32766 and gestpcd_2.id=32766 and datahora between '1996-03-11 00:00:00' and '1996-03-11 23:59:59' order by datahora ASC