General

From Server Knowledge Base
Jump to navigationJump to search

This page will be used for articles and non-specific information.

apt-get upgrade option

Automatically restart services

Written by Leon Teale

cd /root
vim filename.sh #(e.g apachemonitor.sh)

Put the below script in it for Apache2. Replace the service in the ="apache2" field for other processes such as mysql etc.

#!/bin/bash
 limit=0
 [email protected]
 service="apache2" #or replace this with httpd
 process=`ps aux | grep "$service" | grep -v grep  | wc -l`
 if
[ "$process" -le "$limit" ] ;
 then
       if
       [ ! -f /root/apachedown ];
       then
       echo "$service is not running" | mail -s "$service" $admin
       /etc/init.d/apache2 restart #replace this with httpd
       touch /root/apachedown
       else
       /etc/init.d/apache2 restart #replace this with httpd
       fi
 else
 echo "$service is running"
       if
       [ -f /root/apachedown ];
       then
       rm /root/apachedown
       else
       echo ""
       fi
 fi

Then run:

chmod +x /root/filename.sh
crontab -e

Add into crontab -e the following:

* * * * * sh /root/filename.sh

Character Map

Put a semi colon ; after the code below to display the arrows.

&larr = Left Arrow ←
&rarr = Right Arrow →
&uarr = Up Arrow ↑
&darr = Down Arrow ↓
&harr = Left and Right Arrow ↔
&crarr = Corner Arrow ↵

Check MySQL database size

SSH into your server, enter MySQL. If it uses WHM/cPanel log into WHM and go to the SQL Services menu > MySQL Root Password and set it there.

For a Plesk server:

mysql -uadmin -p`cat /etc/psa/.psa.shadow`;

For other servers.

mysql -p

Then:

show databases;
use database
show table status;

Look at the Data_length column for each table, which is in bytes.

Clear your browser cache

http://support.mozilla.org/en-US/kb/clear-cache-delete-temporary-files-fix-issues
http://support.google.com/chrome/bin/answer.py?hl=en&answer=95582
http://webdesign.about.com/cs/internetexplorer/ht/htclearcacheie.htm
http://www.refreshyourcache.com/en/safari

Cloud Hosting

Cloud is good for redundancy particularly if your site is heavily hit and is quite dynamic as multiple copies of your data is spread across several servers.

Create an any size test file

For Virtual Private Servers:

dd if=/dev/zero of=/testfile bs=15M count=1

This also tests the write speed of the disk.

For Dedicated Servers:

dd if=/dev/zero of=/dev/null bs=1M count=32768

Current Windows OS on Webfusion VPS

  • Windows Web for Standard and Community packages
  • Windows Standard for Business and Developer packages
  • Windows Enterprise for Enterprise package

Empty a file

:> /file/path

This always exits true, but produces no output. Good for large old log files.

File exceeds maximum allowed size in joomla

If you see the following image, check one of the below threads:

http://forum.joomla.org/viewtopic.php?f=431&t=660927&view=next
http://www.cmsmind.com/joomla-1-7-help-how-to-modify-the-max-image-upload-size
http://www.simplemachines.org/community/index.php?topic=246794.0

Google Products

AdWords

Google AdWords lets you create an advert for your website and decide which Google search terms you would like to trigger your advert. When people search on Google using these terms, your advert is displayed. You pay a little out of a voucher only when someone clicks on the advert and visits your website.

Google Adsense is the opposite of this effectively.

Analytic's on Media Wiki

cd /var/www/vhosts/domain.com/mediawiki-install-folder/extensions
wget https://sites.google.com/site/rutisextensions/googleAnalytics.zip
unzip googleAnalytics.zip
cd googleAnalystics
chown ftpuser:psacln googleAnalytics.i18n.php googleAnalytics.php
vim googleAnalytics.php

Edit Line 19:

$wgGoogleAnalyticsAccount = "enter-GA-code-here";

Edit Line 25:

function efGoogleAnalyticsHookText($skin, &$text = '')

Exit the file.

cd /var/www/vhosts/domain.co.uk/httpdocs
vim LocalSettings.php

Add in the following at the bottom of the file:

require_once( "$IP/extensions/googleAnalytics/googleAnalytics.php" );

Then you may need to create this file.

vim analyticstracking.php

Add in the following script:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'enter-GA-code-here']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

To migrate your website to another server, you just keep the same files as Google will pick up the site from the new server (and therefore the Google Analytics information above).

PageSpeed

https://developers.google.com/speed/docs/mod_pagespeed/download

Ubuntu/Debian:

wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb
dpkg -i mod-pagespeed-stable_current_amd64.deb
service apache2 restart

ModPagespeedEnableFilters

These, 1, 2 and 3

vim /etc/apache2/mods-enabled/pagespeed.conf
ModPagespeedEnableFilters defer_javascript
ModPagespeedEnableFilters rewrite_css
ModPagespeedEnableFilters fallback_rewrite_css_urls
ModPagespeedEnableFilters rewrite_javascript
service apache2 restart

Image Scaler

Install OpenManage

CentOS 5.5 and 6:

wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash
yum install srvadmin-all

If the below ones fail, looking up a solution currently (29/04/13)

Ubuntu 6:

echo 'deb http://linux.dell.com/repo/community/deb/latest /' | sudo tee -a /etc/apt/sources.list.d/linux.dell.com.sources.list
gpg --keyserver pool.sks-keyservers.net --recv-key 1285491434D8786F
gpg -a --export 1285491434D8786F | apt-key add -
apt-get update
apt-get install srvadmin-all

Ubuntu 8:

echo 'deb http://linux.dell.com/repo/community/deb/latest /' | sudo tee -a /etc/apt/sources.list.d/linux.dell.com.sources.list
gpg --keyserver pool.sks-keyservers.net --recv-key 1285491434D8786F
gpg -a --export 1285491434D8786F | apt-key add -
apt-get update
apt-get install srvadmin-all

Invalid Certificate

If you receive this error in Chrome on https:

"... but the server presented an invalid certificate."

Go to Tools > Options > Under the Hood > untick HTTPS/SSL - Check for server certificate revocation

^M

If lines in a file end in ^M this normally means the file has been edited using a DOS editor. You can remove these manually or using the dos2unix utility.

Ensure /etc/passwd doesn't have dos line endings:

file /etc/passwd

/etc/passwd: ASCII text, with CRLF, LF line terminators

To fix:

dos2unix /etc/passwd
file /etc/passwd

/etc/passwd: ASCII text

Notification stuck on Android

No matter what type of browser you were using, you need to go into Settings > Phone > Apps > All > Download Manager and do Clear Data as well as untick and tick Show Notifications.

Operating Systems PHP, Apache, MySQL, Perl and Python Versions

Operating System PHP Apache MySQL Perl Python
Fedora Core 2 4.3.10 2.0.51 4.1.21 Unknown Unknown
Ubuntu 6.06 LTS 4.4.2 - 5.1.3 2.0.55 5.0.22 5.8.7 2.4.2
Ubuntu 8.04 LTS 5.2.4-5.2.9 2.2.8 5.0.51 - 5.0.96 5.8.8 2.5.2
Ubuntu 10.04 LTS 5.3.2 2.2.14 5.1.41-5.5 5.10.1 2.6.5
Ubuntu 12.04 LTS WIP 2.2.22+ WIP WIP WIP
CentOS 5.5/5.7 5.1.6-5.3.3-5.3.6 2.2.3 5.0.77 5.3.10 2.4.3
CentOS 6.2 5.3.3-5.4 2.2.15 - 2.2.22 5.1.52 5.8.8 2.6.6
Windows Web VPS 5.2.17 - 5.3.5 SQL 2008 R2 Express (free)

Check here to see how to check the SQL version/edition on Windows.
For CentOS PHP 5.3.3 check if you are using a 64 bit system (most likely). If so you need to use x86_64.

Outlook

Do not automatically mark as read

Recall a message in Outlook 2010

Go to your Sent Items folder, double click the message. Make sure in the top right the chevron is a ^ not a v so you can see the Toolbar/Ribbon, then click Actions, then Recall This Message.

Remove folder/account with no OST file

Tools > Account Settings > Data Files > Select the appropriate account > Settings > Advanced > Remove the additional mailbox

Web App signature is greyed out

This happens in Google Chrome. Use Firefox or Internet Explorer to set it in Options > See All Options > Settings > Mail tab > E-mail Signature

PS3 Media Server

Video skipping

There are many reasons for this. See the following threads:

http://tehparadox.com/forum/f28/ps3-media-server-watch-your-1080p-mkv-movies-easy-518971/
http://www.ps3mediaserver.org/forum/viewtopic.php?f=6&t=3507&start=30#p38969

A fix that worked for me was to go into C:\Program Files (x86)\PS3 Media Server\PMB.bat and edit:

start javaw -Xmx768M
#to be the following
start javaw -Xmx3072M

This allocates ~3GB of RAM to Java instead of 768MB. I would advise making a copy of the file first, make a copy of the file elsewhere and edit the value in that second copy, remove the original file and then place the second copy into the folder. This is because it will likely say the file is in use even if you stop PMS, Java, your browser and other services.

Audio out of sync

Method 1) Go into Transcoding Settings > Video/Audio decoder settings > Untick A/V sync alternative method
Method 2) Go into Transcoding Settings > Video/Audio decoder settings > Tick or untick Force framerate parsed from FFmpeg
Method 3) Option 11

Also, using .crt subtitles can cause the same issue. See: http://www.ps3mediaserver.org/forum/viewtopic.php?f=6&t=13366

Random Technical Terms

More to be added.

HAC = High Availability Clustering
SAN = Storage Area Network
NAS = Network-Attached Storage
CSV = Comma-Separated Values

JDK - Java Development Kit
JRE - Java Runtime Environment
Java SE - Java Standard Edition

SE defines a set of capabilities and functionalities; there are more complex editions (Enterprise Edition - EE) and simpler ones (Mobile Edition - ME - for mobile environments).

The JDK includes the compiler and other tools needed to develop Java applications; JRE does not. So, to run a Java application someone else provides, you need JRE; to develop a Java application, you need JDK.

More information at Sun's Java web site, and in particular from the Java SE section, (2nd option, Java SE Development Kit (JDK) 6 Update 10).

Slightly increase performance on *nix server

This is not guaranteed!

apt-get update
apt-get install prelink preload

If you do not use mod_perl or mod_python on your websites, disabling these may decrease memory usage.

Chrome

Add as a search engine

Right click the search box and click the option above. Then in the Name or Keyword box enter the prefix you want to type to initiate the search function.

Firefox

Bookmarks location

C:\Users\user\AppData\Roaming\Mozilla\Firefox\Profiles\0aaaa0a0.default\bookmarkbackups

Add a Keyword for This Search

In Firefox you can skip a page and use a keyword to search directly from the URL bar. To set this up first right-click on the search box and choose 'Add a Keyword for This Search'. That prompts to create a bookmark; give it a name and a short keyword (such as "skb" for this site). You will then be able to search just by going to the URL bar and entering skb *space* and then for example: Plesk

VNC

You can use VNC often to diagnose issues whereby you have issues logging into your server. VNC does not rely on virtual machine network connectivity as it's the equivalent of plugging a monitor/keyboard/mouse into a physical machine.

CentOS 6
Ubuntu 10.04

To VNC to a console higher then 100, simply use :60** where ** is the last 2 digits of the console number.

Several good VNC programs are mRemote, Tight VNC or RealVNC.

www to non-www

Guides for Magento: 1, 2 and 3

See second response in here as to why a Magento installation may show the IP instead of the domain name when going to your website.