Thursday, October 25, 2012

Few good links

The following are comprehensive configuration examples.

1) You can obtain 3DES key free from:

2) Free Software Download Page:

3) Good link to obtain TFTP, SYSLOG, FTP etc:   (Only tftp server)

4) Complete list for IANA Ports Information:

5) Bandwidth Utilization:

Apache benchmarking tool (ab) + CentOS

yum install apr-util
yum install yum-utils

ab -n 50 -c 10
It will test 50 requests + maximum of 10 requests running concurrently

The -c parameter specifies the number of connections; the -k stands for HTTP Keep-Alive; and the -t parameter sets the time in seconds for which each connection is alive
ab -n 50 -kc 10 -t 60

Run this command on the webserver to analyze the traffic as well 
tcpdump -nn 'tcp[tcpflags] == tcp-rst' and port 80 and src host x.x.x.x 

Tuesday, October 23, 2012

Easy Twiki backup

cd /var/www
/etc/init.d/httpd stop
sleep 5
tar -zcf twiki.tgz twiki
mv twiki.tgz /home/public/sync/
/etc/init.d/httpd start
cd /home/public/sync
ls -la | mail -s "backup $HOSTNAME -'date'"

Monday, October 22, 2012

Search & Delete the logs + cron

Delete from a path
sudo find /Path-to-directory/ -name *.log  -exec rm -rf -v {} \;

Delete from the current directory
sudo find . -type f -name "*.bak" -exec rm -rf -v {} \;

By default cron jobs sends a email to the user account executing the cronjob. If this is not needed put the following command At the end of the cron job line .
>/dev/null 2>&1

To collect the cron execution execution log in a file :
30 18 * * * rm /home/someuser/tmp/* > /home/someuser/cronlogs/clean_tmp_dir.log

Saturday, October 6, 2012

Delete emails from mailbox/es – Exchange 2007

First Grant all the permission to the mailboxes you are to have empty.
Get-Mailbox "target-username" | Add-MailboxPermission -AccessRights FullAccess -User "my-username"

Put the below command in the a file and save it as a .ps1 file - It will delete all the emails from a mailbox catchall without prompting

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin

Get-Mailbox -Identity catchall | Export-Mailbox -DeleteContent  -Confirm:$false


Put the below command in a file and save it it as a  .bat file and schedule it in windows scheduler
Powershell.exe -command "& {d:\scripts\catchallMailDelete.ps1}"


Delete everything: (from all Mailboxes)
Get-Mailbox | Export-Mailbox -DeleteContent

Export everything: (and then delete the mails from the mailbox)
Get-Mailbox | Export-Mailbox -PSTfolderPath "c:\temp" -DeleteContent

Delete Emails with a given sender name:
Get-Mailbox | Export-Mailbox -SenderKeywords -DeleteContent

Friday, October 5, 2012

Deploying with Capistrano

  1. sudo gem install capistrano-ext
  2. cd yours_rails_directory
  3. capify .
  4. mkdir config/deploy
Now we will create two deployments staging and production and a new staging environment.

  1. touch config/deploy/staging.rb
  2. touch config/deploy/production.rb
  3. touch config/environments/staging.rb
  1. config/deploy.rb
  2. config/deploy/production.rb
  3. config/deploy/staging.rb
  4. config/environments/staging.rb:  
  5. config/databases.yml
Now run the capistrano commands to set up the deployment. 
  1. cap staging deploy:setup
    (this creates the correct directory tree)
  2. cap staging deploy:check
    (this checks to make sure setup ran)
  3. cap staging deploy:update
    (this updates the server with the app code)
  4. ssh your_user_name@your_deployment_server
    (fill in the correct user and server here)
  5. cd your_deployment_directory/current
    (again fill in the correct deploy to dir)
  6. RAILS_ENV=staging sudo rake gems:install
    (this installs gems that need native compiling)
  7. RAILS_ENV=staging rake db:schema:load
    (loads the database)
  8. RAILS_ENV=staging rake db:seed
    (loads any seed data)
  9. script/console staging
    (load the console for testing)
  10. app.get('/')
    (test to see if this returns ‘200’)
  11. exit
    (exit the console)
  12. exit
    (exit ssh)
  13. cap staging deploy:restart