Posted by
Daniel Kühl Lima in
Bash
Sep 21st, 2009 |
No Comments
Script para converter nomes de arquivos de MAIÚSCULAS para minúsculas.
#!/bin/bash
file="$1"
if [ $# -eq 0 ]
then
echo "$(basename $0)"
exit 1
fi
if [ ! $file ]
then
echo "$file não é um arquivo"
exit 2
fi
lowercase=$(echo $file | tr '[A-Z]' '[a-z]'])
if [ -f $lowercase ]
then
echo "Erro - Arquivo já existe!"
exit 3
fi
# troca o nome do arquivo
/bin/mv $file...
Posted by
Daniel Kühl Lima in
Linux, Seguranca
Sep 21st, 2009 |
No Comments
Crie o arquivo /etc/iptables/blocked.ips com a lista de IPs ou redes a serem bloqueados.
Como exemplo
192.168.0.0/24
200.122.53.11
74.67.1.213
E o script que será o responsável por carregar as regras.
#!/bin/bash
IPT=`which iptables`
SPAMLIST="spamlist"
SPAMDROPMSG="SPAM LIST DROP"
BADIPS=$(egrep -v -E "^#|^$" /etc/iptables/blocked.ips)
# create a new iptables list
$IPT -N $SPAMLIST
for ipblock in $BADIPS
do
$IPT -A $SPAMLIST -s $ipblock -j LOG --log-prefix "$SPAMDROPMSG"
$IPT -A $SPAMLIST -s $ipblock -j DROP
done
$IPT -I INPUT -j $SPAMLIST
$IPT -I OUTPUT -j $SPAMLIST
$IPT -I FORWARD -j...
Posted by
Daniel Kühl Lima in
Linux
Sep 12th, 2009 |
1 Comment
Na instalação do SO foi selecionado o layout Brazil ABNT2, mas agora no Data Center os teclados são US International…
Como alterar?
Editar o arquivo /etc/sysconfig/keyboard e alterar a linha onde se diz:
KEYTABLE="br-abnt2"
para
KEYTABLE="us-acentos"
A alteração tem efeito imediato para novas sessões...
Posted by
Daniel Kühl Lima in
FreeBSD
Sep 11th, 2009 |
No Comments
No Linux temos o programa hdparm que faz esse teste de velocidade do HD, mas como ter essa mesma medição sendo feito em discos no FreeBSD?
...
Posted by
Daniel Kühl Lima in
Bash, Email, FreeBSD, Linux
Aug 30th, 2009 |
5 Comments
As vezes é necessário enviar um email no Linux, FreeBSD ou Unices via linha de comando com um anexo.
Esse procedimento também pode ser utilizado como parte de um Shell script que envia relatórios anexados para o email do administrador.
...
Posted by
Daniel Kühl Lima in
Linux
Feb 28th, 2009 |
2 Comments
Quando já se tem um Volume configurado, adicionar um disco ao Grupo do Volume com o sistema e com o LVM online facilita a vida.
...