Archive for Outros

Remover Linhas Iguais Linux

sort arquivo | uniq >> novo arquivo

Link Script Perl “loco”

https://launchpad.net/ubuntu/+source/loco

Correção do erro da biblioteca libevent

error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

The solution for this on Debian/Ubuntu (and probably most other linux distros) is this…

On a 32 bit system:

ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5

On a 64 bit system:

ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5

Créditos : http://www.nigeldunn.com/2011/12/11/libevent-2-0-so-5-cannot-open-shared-object-file-no-such-file-or-directory/

Práticas Recomendados Performance TrendMicro

Problem Description

The Worry-Free Business Security (WFBS) Agent’s antivirus and anti-spyware real-time scan scans files for malicious code as they are accessed or created.
 
When some programs create or modify files rapidly, the Security Agent may use a lot of resource verifying the legitimacy of all file accesses. With the current default settings, the Security Agent will exclude the folders frequently modified by these programs:
 
Worry-Free Business Security Server
Microsoft Exchange 2000/2003/2007/2010
Active Directory Domain Services (Windows Server Role)
 
Note: These settings can be modified  in the Security Server’s web console, under the Preferences > Global Settings > Desktop/Server section.
 
Some programs or operating system features do not have default options in WFBS to exclude folders and files from real-time scan. If you encounter performance issues running one of these programs, you can modify the Security Settings in the Security Server’s web console.
 
Important: These security settings will reduce the protection on your computer. For publicly available servers, please review these settings and the nature of the services before applying these settings.

Solution

To resolve the issue, please do the following:
 
1. Log on to the WFBS console.
   
2. Go to Security Settings > Group > Configure.
   
3. Check if you have the following programs and then exclude the specified folders, files, or extensions:
   
  Outlook:
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following extensions:
     
    o .PST
     
  Windows Update Store:
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o C:\Windows\SoftwareDistribution\Datastore
     
  Windows Software Update Services (WSUS) Server:
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o <WSUS storage driver letter>:\MSSQL$WSUS
       
    o <WSUS storage driver letter>:\WSUS
       
    o <WSUS storage driver letter>:\WsusDatabase
     
  DHCP Server (Windows Server Role):
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o C:\Windows\system32\dhcp
     
  DNS Server (Windows Server Role):
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o C:\Windows\system32\dns
     
  WINS Server (Windows Server Role):
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o C:\Windows\system32\wins
     
  Print and Document Services (Windows Server Role):
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o C:\Windows\system32\Spool\
     
  Remote Storage Service
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o C:\windows\system32\ntmsdata
     
  POP3 Connector in Windows Small Business Server (SBS) 2003:
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directory:
     
    o C:\Program Files\Microsoft Windows Small Business Server\Networking\POP3\Failed Mail
       
    o C:\Program Files\Microsoft Windows Small Business Server\Networking\POP3\Incoming mail
     
  Internet Information Services (IIS) 6.0 or Web Server role on Windows Server 2003:
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o C:\inetpub\wwwroot
       
      Note: This may depend on your IIS configuration. You might need multiple folders when multiple websites are configured.
       
    o C:\Windows\system32 \LogFiles
       
      Note: This may depend on your IIS configuration. You might need multiple folders when multiple websites are configured.
       
    o C:\windows\IIS Temporary Compressed Files
     
  Internet Information Services (IIS) 7.0 or Web Server role on Windows Server 2008:
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o C:\inetpub\wwwroot\
       
      Note: This may depend on your IIS configuration. You might need multiple folders when multiple websites are configured.
       
    o C:\inetpub\logs\
       
      Note: This may depend on your IIS configuration. You might need multiple folders when multiple websites are configured.
       
    o C:\inetpub\temp\IIS Temporary Compressed Files
     
  Microsoft SQL Server:
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o <SQL Server Installed folder>\*\OLAP\Data
       
    o <SQL Server Installed folder>\*\OLAP\Backup
       
    o <SQL Server Installed folder>\*\OLAP\Log
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following extensions:
     
    o .MDF
       
    o .LDF
       
    o .NDF
       
    o .BAK
       
    o .TRN
     
  Microsoft SQL Server  Failover Cluster:
     
    Note: The < cluster service account> is the account that the specific account is running for cluster service.
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o <Quorum driver letter>:\
       
    o C:\windows\cluster
       
    o For Windows 2003 only: C:\Documents and Settings\<cluster service account>\Local Settings\Temp\
       
    o For Windows 2008 only: C:\Users\<cluster service account>\AppData\Local\Temp
     
  SharePoint Portal Server:
     
    Note: The<SharePoint service account> is the account that the specific account is running for SharePoint services
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o C:\Program Files\SharePoint Portal Server
       
    o C:\Program Files\Common Files\Microsoft Shared\Web Storage System
       
    o C:\Program Files\Common Files\Microsoft Shared\Web Service Extensions
       
    o C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions
       
    o C:\Program Files\Microsoft Office Servers
       
    o C:\Windows\Temp\Frontpagetempdir
       
    o C:\Windows\Temp\WebTempDir
       
    For Windows 2003 only:
       
    o C:\Documents and Settings\All Users\Application Data\Microsoft\SharePoint\Config
       
    o C:\Documents and Settings\<SharePoint service account>\Local Settings\Application Data
       
    o C:\Documents and Settings\<SharePoint service account>\Local Settings\Temp\
       
    o C:\Documents and Settings\Default User\Local Settings\Temp
       
    For Windows 2008 only:
       
    o C:\Users\<SharePoint service account>\Local
       
    o For Windows 2008 only: C:\Users\<SharePoint service account>\Local\Temp
       
    o For Windows 2008 only: C:\Users\Default\AppData\Local\Temp
       
    o For Windows 2008 only: C: \ProgramData\Microsoft\SharePoint\Config
     
    For 32-bit platforms:
     
    o C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
       
    o C:\Windows\system32\LogFiles
     
    For 64-bit platforms:
     
    o C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files
       
    o C:\Windows\Syswow64\LogFiles
     
  Internet Security and Acceleration Server (ISA) Server:
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o C:\Program Files\Microsoft ISA Server\ISALogs
       
    o C:\Program Files\Microsoft SQL Server\MSSQL$MSFW\Data
     
  Microsoft Operations Manager Server (MOM) 2005:
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o C:\Documents and Settings\All Users\Application Data\Microsoft\Microsoft Operations Manager
       
    o C:\Program Files\Microsoft Operations Manager 2005
     
    Hyper-V:
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o C:\ProgramData\Microsoft\Windows\Hyper-V
       
    o C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks
       
    o C:\ProgramData\ProgramData\Microsoft\Windows\Hyper-V\Snapshots
       
    o For Windows 2008 R2 only: C:\ClusterStorage
       
    o <Custom virtual machine configuration directories>
       
    o <Custom virtual hard disk drive directories>
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following extensions:
     
    o .AVHD
       
    o .ISO
       
    o .VFD
       
    o .VHD
       
    o .VSV
       
    o .XML
     
  VMWare products:
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o <the folders that contain the virtual machines >
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following extensions:
     
    o .VMDK
       
    o .VMEM
     
  Citrix products:
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following directories:
     
    o The roaming profiles folder on the file server>
     
    Go to Antivirus/Anti-spyware > Target > Do not scan files with the following extensions:
     
    o .LOG
       
    o .DAT
       
    o .TMP
       
    o .POL
       
    o .PF
     
  To enhance the performance on Windows Vista/2008/7, you can go to the Preferences > Global Settings >Desktop/Server in the WFBS console and check the Exclude Shadow Copy sections option.

Créditos : http://esupport.trendmicro.com/solution/en-US/1059182.aspx?utm_source=productWFBS&utm_media=SSCon&ProdVer=17.0.2360

SSMTP Google Apps

Edit /etc/ssmtp/ssmtp.conf

I found it easiest to comment out all the existing lines in the config and then add the following.  Replacing the capitalized text with your own information.  This works for GMail and Google Apps accounts.

1 mailhub=smtp.gmail.com:587
2 hostname=USER@MYDOMAIN.com
3 root=USER@MYDOMAIN.com
4 AuthUser=USER@MYDOMAIN.com
5 AuthPass=PASSWORD
6 UseSTARTTLS=yes
7 UseTLS=yes
8 FromLineOverride=yes

Edit /etc/ssmtp/revaliases

This file associates the computer’s local user accounts with email accounts that have been defined in the config.  As an example, I’ve defined email for the following two local user accounts (but you’ll want to replace matt with something else):

1 root:USER@MYDOMAIN.com:smtp.gmail.com:587
2 matt:USER@MYDOMAIN.com:smtp.gmail.com:587

Send a Test Email

This is where the revaliases config comes into play.  If you’ve only associated root with an email address then you’ll have to send a test email using the sudo command:

1 sudo ssmtp test@test.com
2 To: Test Guy <test@test.com>
3 From: Me <USER@MYDOMAIN.com>
4 Subject: Hello World
5
6 Hello world!

Note the blank line between subject and body.  Once the body is finished, hit return to advance to the next line and then press CTRL+D to send.

Créditos : http://www.bunkerhollow.com/blogs/matt/archive/2010/10/12/ubuntu-send-email-with-ssmtp-and-google-apps-gmail.aspx

Redirect Http PHP

<?php
$redirect = “http://www.locaweb.com.br”;
header(“location:$redirect”);
?>

Créditos : http://wiki.locaweb.com.br/pt-br/Redirect_em_PHP

Alterar Senha root MYSQL Esquecida

[root@firewall /]# /etc/init.d/mysqld stop
Stopping mysqld: [ OK ]
[root@firewall /]# mysqld_safe –skip-grant-tables &
[1] 3489
[root@firewall /]# 120525 16:11:52 mysqld_safe Logging to ‘/var/log/mysqld.log’.
120525 16:11:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

[root@firewall /]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.61 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set password = password(‘123456′) where user=’root’ and host=’localhost’;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit;
Bye
[root@firewall /]# /etc/init.d/mysqld restart
120525 16:12:34 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
[1]+ Done mysqld_safe –skip-grant-tables
[root@firewall /]#

Créditos : http://www.dicas-l.com.br/arquivo/bind-chroot_no_centos_5.3.php

Script de Backup SystemState

—————————————————————————————————-

C:
del /Q /F /S “F:\WindowsImageBackup.7z”
del /Q /F /S “F:\WindowsImageBackup”
rd /q /s “F:\WindowsImageBackup”
wbadmin start systemstatebackup -backupTarget:f: -quiet
F:\7ZIP\7za.exe a -t7z -y -mx3 “F:\WindowsImageBackup.7z” F:\WindowsImageBackup
del /Q /F /S “F:\WindowsImageBackup”
rd /q /s “F:\WindowsImageBackup”
exit

—————————————————————————————————-

Script VB Fazer Recovey do erro de Papel de Parede

É muito comum ocorrer erro de Active Desktop quando você aplica política de papel de parede por GPO e o usuário acaba desligando o computador incorretamente. Para resolver o problema alguns até mesmo chegam a recriar o perfil do usuário. Segue um script que corrige esse problema. Você deve salva-lo em .vbs e executá-lo na estação de trabalho com problema. O script deve ser executado apenas uma vez, caso o problema ocorrer novamente, você deve executá-lo novamente.


‘***************************************************************************
‘ WMI Script – ActiveDesktop.vbs

‘ Corrige error en el active desktop

‘***************************************************************************
Rem Definiciones
Dim objShell, RegLocate, RegLocate1
Const EWX_LOGOFF   = 0
Rem Librerias
Set objShell = WScript.CreateObject(“WScript.Shell”)
Set objShell = CreateObject(“Wscript.Shell”)
On Error Resume Next
Rem Cambia el valor del DWORD (Clave del registro)
RegLocate = “HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\SafeMode\Components\DeskHtmlVersion”
objShell.RegWrite RegLocate,”0″,”REG_DWORD”
Rem Advierte del deslogeo
intReturn = objShell.Popup(“Se va a cerrar la sesion para guardar los cambios, presione aceptar”, _
20, “Auto LogOff”, wshYesNoDialog + wshQuestionMark)
If intReturn = wshYes Then
For Each objPC In GetObject(“winmgmts:{(shutdown)}”).ExecQuery(“Select * from Win32_OperatingSystem”)
objPC.Win32Shutdown LOGOFF + FORCE
Next
ElseIf intReturn = wshNo Then
wscript.Quit
Else
Rem Si no responde se forza el deslogeo
For Each objPC In GetObject(“winmgmts:{(shutdown)}”).ExecQuery(“Select * from Win32_OperatingSystem”)
objPC.Win32Shutdown LOGOFF + FORCE
Next
End If
WScript.Quit

Crédito : http://www.msitpro.com.br/?p=283

Script Backup Diário em Disco

[root@sysweb bin]# cat backup-disco.sh
#!/bin/bash
# Script de Backup em Disco
# Backup na Pasta /backup
# Qualityinfo Solucoes em Informatica
# Marlo Luiz Binsfeld
# variaveis
data=`date +%d%m%Y`
hora=`date +%H%M`
bkpant=`/sbin/funcoeszz.sh zzdata hoje – 5|cut -c 1,2,4,5,7,8,9,10`
# apaga backup anterior a 5 dias
/bin/rm -f /backup/etc-$bkpant-*.tar.gz
/bin/rm -f /backup/www-$bkpant-*.tar.gz
/bin/rm -f /backup/mysql-$bkpant-*.tar.gz
# cria arquivos compactados
cd /backup
/bin/tar -zcvf etc-$data-$hora.tar.gz /etc
/bin/tar -zcvf www-$data-$hora.tar.gz /var/www/html
/bin/tar -zcvf mysql-$data-$hora.tar.gz /var/lib/mysql