RSS feed

3ware tw_cli

December 16th, 2008 | Posted in Linux | No Comments

7000 and 8000 series 3ware Escaladeā„¢ ATA RAID controllers manual http://www.3ware.com/support/UserDocs/CLI_UG.pdf http://www-d0.fnal.gov/~melnit/tw_cli.8.html

Read More

 



PowerDNS with Geo Backend

December 6th, 2008 | Posted in Linux, PowerDNS | 1 Comment

A short guide on how to setup powerdns with the geo and mysql backends to redirect visitors to servers closer to their geographic location. So how does it work? We delegate geo.www.domain.com to our powerdns servers that run the geo backend. The backend looks up the IP address of the user’s resolver in a data [...]

Read More

 



Sending mail from Perl

December 3rd, 2008 | Posted in Linux, Perl | No Comments

I am using this as a skeleton in various scripts where I need to be notified of errors or successful runs… #!/usr/bin/perl open(MAIL,”|/usr/lib/sendmail -t”); print MAIL “To: you\@domain.com\n”; print MAIL “From: name \n”; print MAIL “Subject: your subject\n\n”; print MAIL “\nnotification\n”; close (MAIL);

Read More

 



Speed up your site by caching

December 2nd, 2008 | Posted in Linux | No Comments

Implementing caching on high traffic websites will save you loads of bandwidth and drastically speed up your site loading time for visitors. By using apache modules mod_expires and mod_header you will be able to control exactly what is cached, how long it’s cached for and how proxy servers should behave around your websites. All static [...]

Read More

 



sed inline replace/delete

December 2nd, 2008 | Posted in Linux | No Comments

sed -i ‘s/foo/bar/’ file(s) or * or sed -i ‘/foo/d’ file(s) or * or find /path/to/files -type f -name myfile1 -exec sed -i ‘s/foo/bar/’ {} \; or find /path/to/files -type f -name myfile1 | xargs sed -i ‘s/foo/bar/g’

Read More

 



awk quotes

December 2nd, 2008 | Posted in Linux | No Comments

cat file | awk ‘{ print “mysql mydatabase -u ” $3 ” -p”$4″ -h ” $2 ” -e \042SELECT name FROM domains WHERE status = \0470\047\042 >> “$1″.active”}’ echo -e “\047″ \047 being a single quote \042 being a double quote

Read More

 



unix print ip

November 29th, 2008 | Posted in Linux | No Comments

If you ever needed to get your own IP from shell to use in scripts… host $(who -m | awk ‘{ print $5 }’ | sed ‘s/[()]//g’) | awk ‘{ print $4 }’ Above code is used in a script which updates apache ACL’s with current IP… makes it much easier than manually editing.

Read More

 



grep copy

November 29th, 2008 | Posted in Linux | No Comments

#!/usr/bin/sh cp `grep -lr ‘STRING’ /dir` /newdir

Read More

 



sudo: sorry, you must have a tty to run sudo

November 29th, 2008 | Posted in Linux | 1 Comment

ssh -t -t login host or vi /etc/sudoers #Default requiretty :wq Quoted directly from /etc/sudoers # Disable “ssh hostname sudo “, because it will show the password in clear. # You have to run “ssh -t hostname sudo “.

Read More

 



Disable SSLv2

November 29th, 2008 | Posted in Linux | No Comments

/etc/httpd/conf.d/ssl.conf: SSLCipherSuite ALL:!ADH:!LOW:!SSLv2:!EXP:+HIGH:+MEDIUM SSLProtocol all -SSLv2

Read More

 




Categories