Tips: Linux/Unix world


See all

Articles: Fix for PageSpeed Module Causing High Server Load

Posted by: david on Wednesday/December 09/2015 - 04:05 PM
Linux Tips

Google's PageSpeed Module has had a lot of praises heaped upon it for its ability to perform a myriad of performance optimizations to help web servers deliver content quicker. I had tried it in the past on my servers (running CentOS & Apache) but was always hit by heavy, unacceptable server loads. So I've always had to just go back and disable it. That was actually a couple of years ago, so recently I gave it another go. I downloaded the latest beta version (mod_pagespeed version 1.9.32.10-7423). Installation was easy, though I....

Articles: Fix for Broken Yum on CentOS 5.x with Python Error Message

Posted by: david on Thursday/August 06/2015 - 10:45 PM
Linux Tips
So I was looking to upgrade PHP on one of my servers running CentOS 5.7 from PHP 5.3.x to PHP 5.5. I wanted to get it to 5.6 actually but unfortunately there is no such package available on Webtactic.com. But anyways I began the process by running the command:

yum install yum-plugin-replace


Which resulted in a shocking error message:


There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

/usr/lib/libnssutil3.so: undefined symbol: opyAlgorithmID_Util, version NSSUTIL_3.12

Please....

Articles: Android X86 Black Screen Fix (Wake Up from Sleep), + Tips & Wishlist

Posted by: david on Saturday/March 14/2015 - 10:50 PM
Linux Tips


The Android-x86 Project works fairly well. I installed the 4.4.4 version (KitKat) on a virtual machine (VM) created using the free VMWare Player. A beefy Windows 8.1 PC is the host PC. A couple quirks were that I had to delete the default SCSI hard drive device, and then add a replacement IDE drive to the VM. It works great for the most part, except that the mouse is occasionally laggy, and for some reason after a specified amount of time, all I get is a Blank Screen.

Articles: Solution to MySQL Subtraction of Integers Problem Resulting in Negative Number

Posted by: david on Tuesday/September 11/2012 - 01:49 AM
Linux Tips
I ran into a weird problem, so I thought, with MySQL today. I have a MySQL table (let's call it "verizon_fios" for our example) with a pair of integer columns (promotion_code_a and promotion_code_b) that I want to do some calculation with- specifically subtracting one number from another.

server1837>select promotion_code_a from verizon_fios where id = 237;
+------------+
| promotion_code_a |
+------------+
| 0 |
+------------+

server0117>select promotion_code_b from verizon_fios where id = 237;
+----------+
| promotion_code_b |
+----------+
| ....


Articles: A Solution for mysqldump: Got errno 32 on write

Posted by: david on Monday/August 22/2011 - 01:20 PM
Linux Tips
I was using mysqldump to backup mysql data from one server to another. It was working well until recently after I added a few more lines to my command line backup script- basically to backup more tables. In the script I have individual lines to backup single tables in this example format:

mysqldump -uusername -ppassword -hsource_server --compress --skip-lock-tables --lock-tables=false database_to_backup table_to_backup | mysql -uusername_of_local_server -ppassword_of_local_server name_of_local_database

Whenever cron ran the script, I was getting the error:

ERROR 1049 (42000): Unknown database 'database_to_backup'
mysqldump: Got errno 32 on write

It turned out that....


Articles: Block/Prevent Domain Name That Is Not Yours from DNS Resolving to Your IP/Server in Apache

Posted by: david on Sunday/May 22/2011 - 01:01 AM
Linux Tips
Many of our websites allows people to make comments, and we get an email whenever there is a new comment, and that email will contain the domain name so we know where it came from. Recently I noticed that there were some comments from a strange domain that does not belong to us. For the purposes of this article I'm calling the unauthorized domain "hacker-domain.jerk", and that our actual domain is "coolcomputing.com" hosted at the IP address of 1.2.3.4. What was happening was that someone nefarious set up their domain name to DNS point at....

Articles: Apache Configuration for Domain Redirection for Unforeseen Sub-domains

Posted by: david on Monday/May 16/2011 - 05:02 PM
Linux Tips
One of our websites all of a sudden had visitors through Google via it's name server subdomain of NS1. For instance, people come coming in through (for instance) ns1.Coolcomputing.com instead of www.coolcomputing.com for some reason. Of course, we don't want any sort of duplicate content/listing on search engine results, so what we need to do is to redirect those sub-domain names to the proper one (www). Here's how we did it via Apache to do a permanent 301 redirection (you need tje Apache rewrite module turned on)- example httpd.conf virtualhost configuration chunk below:

<VirtualHost....


Articles: Get the Current Hour/Minute and Time Comparison Logic for BASH Script in Linux

Posted by: david on Tuesday/March 29/2011 - 04:14 PM
Linux Tips
On one of our Linux servers running CentOS 5 I wanted to run a cron job on a script that download a certain file every 15 minutes, but the source hosting the file only allows up to a certain downloads daily. Therefore I needed to get some sort of logic in the bash script so that it skips certain hours. To get the current hour and store it in a variable, I had in the file:

cur_hour=$(date +"%H");

If you also need to get the current minute, you would do a:

cur_min=$(date +"%M");

Articles: PHPBB Flood Error Fix and RC.LOCAL the Linux Version of the Startup Folder/Autoexec.bat

Posted by: david on Thursday/March 17/2011 - 02:11 PM
Linux Tips
A Linux server, running CentOS 5 and hosting one of our PHPBB forum sites had to be rebooted last night. Afterward no one could post anymore because everyone was getting the following error message:

"You cannot make another post so soon after your last; please try again in a short while."

I did a scan on the MySQL database and everything checked out fine, so I looked in the file "functions_post.php" (I'm using PHPBB2, BTW) and determined that it was a time issue. Running "date" on the command line showed that the time was....


Read the Entire Article 1 Review/Comment

Articles: Fix for Vim Weird "Â" Character Appearing When You Type/Paste ASCII Character

Posted by: david on Thursday/November 04/2010 - 06:42 PM
Linux Tips
I was editing some files with vim on a new Linux server and was getting frustrated that everytime I try to type in or paste in the British Sterling/British pound symbol of £ it is prefixed with a strange character of Â. I did not have this problem with the pervious server I was using, which is based on FreeBSD. And when I tried to delete that character it deletes the £ character as well.

After almost pulling my hair out, I just figured out that it is an issue with character encoding....


Articles: Fix Black Diamond with Question Mark in HTML After Switching Servers

Posted by: david on Thursday/November 04/2010 - 04:12 PM
Linux Tips
Recently I switched the web hosting service provider, and noticed these odd black diamond shaped characters with a question mark in the middle on my web pages. Characters such as the double quote and the copyright symbol are all being replaced by this foul black diamond character with the ? in the center. Doing some research, it seems that happens because you have a character set, or charset, that does not match between the database, web server, and PHP.

I use Apache, MySQL, and PHP. Looking at the httpd.conf I noticed:


Articles: BASH IF ELSE Example Plus Nested IF Example

Posted by: david on Saturday/September 25/2010 - 06:20 PM
Linux Tips
Here is an example of the usage of an IF Else with a Nested IF for writing a script for BASH:

current_hour=$(date +"%H");

#if it is past midnight but not yet 6 AM
if [ $current_hour -ge 0 -a $current_hour -lt 6 ]
then
    echo "You are not in bed yet?"
else
    #if it is 6PM but not yet 8PM
    if [ $current_hour -ge 18 -a $current_hour -lt 20 ]
    then
         echo "Dinner time!"
     fi
fi

Here are....

Articles: Backup your files using tar and gzip

Posted by: david on Wednesday/January 08/2003 - 01:12 AM
Linux Tips

The following command backs up the foobar directory into a file called foobar.tgz:

tar cvf - /home/foobar | gzip > /home/backup/foobar.tgz

With the newer versions of the GNU tar the above can be shortened to:

tar cvfz /home/foobar /home/backup/foobar.tgz



Here is a video that demos how you would goes into more detail, as well as setting up the back-up task using cron.



Articles: Delete all messages in Pine

Posted by: david on Sunday/November 10/2002 - 08:52 PM
Linux Tips

Here is the combination of keys to mark all messages for delete in Pine, the popular console-based email client for Linux and other *nix operating systems:

;aad

Even though pine is no longer being developed, Alpine and Re-Pine are a pair of projects that built upon the venerable command-line based Linux email reader.

Here is a video on how to setup Gmail with Alpine:


Articles: Changing the date in Linux

Posted by: david on Sunday/November 10/2002 - 08:48 PM
Linux Tips
To change the date in Linux, use the date command, which has the following syntax:

date MMDDHHmmYYYY

e.g.

[root@scooter logs]# date 111017482002
Sun Nov 10 17:48:00 PST 2002

Then you should run "hwclock", which synchronizes the hardware clock with the OS clock- just type the following:

hwclock --set --date="`date '+%m/%d/%y %H:%M:%S'`"