Archive for 'Linux'
How to find what robots have visited my website
Ever wonder how to find out what robots/crawlers have visited your site? If you don’t have robust log analyzer there is another way. If you are using apache there is a simple way from the command line to figure out how as been visiting.
grep robots.txt /etc/httpd/domlogs/bumideas.com|awk -F ‘”‘ ‘{print $6}’|sort -k 1|uniq -c
What […]
Posted: August 24th, 2008 under Linux, SEO, Apache.
Comments: none
How to bulk replace strings in a file on linux
Ever find that you need to do a bulk/mass replacement of strings in a file on a linux server? I ran into a situation where I needed to change a website from using persistent connections to mysql to normal. This involved changing mysql_pconnect to mysql_connect. Using grep, There were about 5 files to change.
Of course […]
Posted: August 16th, 2008 under PHP, Linux.
Comments: none
Tutorial for securing your linux server
Just surfing for fun today and came across a quick and easy tutorial for securing your linux server. While not the end all for security, it sure is a great start.
http://mysql-apache-php.com/basic-linux-security.htm
Posted: July 6th, 2008 under Linux, Firewalls and Security.
Comments: none
Scheduling a program using the crontab file
From the internet, and slightly adjusted for a linux system… [http://www.kalab.com/freeware/cron/cron.htm]
The Crontab file
Each line of CRONTAB has the following structure:
Position: Values:
Minute 0-59
Hour 0-23
Day 1-31
Month 1-12
Day of week 0-6 (0=Sunday, 1=Monday, …, 6=Saturday)
Instead of minute, hour, day, month or day of week it’s also possible […]
Posted: May 4th, 2008 under Linux.
Comments: none
Where to get mod_security rules?
Mod_security is an awesome tool to scan query strings for malicious content…blocking it before it ever enters execution.
One of the best resources I have ever found to get some mod_security rules. They have both rules for versions 1 and 2. These rules block hundreds of attempts on my server every day.
http://www.gotroot.com/downloads/ftp/mod_security/rules.conf
Posted: April 20th, 2008 under Linux, Firewalls and Security, Apache.
Comments: none
Need a list of all the open files on linux?
How do you get a list of all the open files on linux? There is a simple command that can give you all the information you need.
lsof
There are several helpful options to this command…
lsof by itself will give you all the open files. pipe this through grep to find what you are looking for.
lsof -p […]
Posted: April 20th, 2008 under Linux.
Comments: none
Logging long running queries in mysql
Here is another nugget from the mysql world.
Mysql has a built in logger for tracking down those queries that are long running queries. Technically mysql likes to call them “slow queries”
1. Login to your server as root
2. Open my.cnf with your favorite editor. Example:
[…]
Posted: March 29th, 2008 under Linux, MYSQL.
Comments: none
quick script to check the status of a linux raid 3ware controller
3ware is a pretty common controller in linux boxes, there is a command utility tw_cli to check the status. You can automate the checking via a simple bash script that you can put into your cron. here is some code
#!/bin/bash
com=`/path_to_ tw_cli/tw_cli info c0 u0 status | awk ‘{print $4}’`
echo $com
if [ “$com” = […]
Posted: February 12th, 2008 under Linux, Disaster Recovery.
Comments: none
MySQL query_cache_size, how cache can help your website performance
here is a clipping from the MySQL manual regarding the query cache to help your website performance.
mysql> SHOW VARIABLES LIKE ‘query_cache_size’;
+——————+——-+
| Variable_name | Value |
+——————+——-+
| query_cache_size | 41984 |
+——————+——-+
For the query cache to actually be able to hold any query results, its size must be set larger:
mysql> SET GLOBAL query_cache_size = 1000000;
Query […]
Posted: February 5th, 2008 under Linux, MYSQL.
Comments: none
How to find reciently changed files
Looking to see what has changed on your linux server lately? This command will find files changed in the last 10 days
find ./ -type f -mtime -10 -exec ls -al {} \;
Posted: January 20th, 2008 under Linux.
Comments: none