Archive for April, 2010

SBDavid

Cpanel Install and Licence

Cpanel Install and Licence

You may install cPanel without a license, however it will not be usable until you obtain a license.

Also you need the public ip address of the machine that you plan on running cPanel on.

You can get this address by running the below command if you have lynx installed.

lynx -dump http://www.cpanel.net/showip.cgi

If you don’t have lynx installed and are directly connected to the internet, you can use the below command:

/sbin/ifconfig eth0 |grep inet | awk ‘{print $2}’ | awk -F: ‘{print $2}’

-dump dumps the formatted output of the default document or those specified on the command line to standard output. Unlike interactive mode, all documents are processed. This can be used in the following way:

lynx -dump http://www.subir.com/lynx.html
SBDavid

Installing Ruby on Cpanel

Installing Ruby

To begin, you will need root access to the server on which you wish to install Ruby

Requirements

cPanel version 11.

Log into your server as the root user and issue the following command via the command line:

yum list ruby

Execute the following script to install Ruby:

/scripts/installruby

After installing Ruby, you will need to make sure that the appropriate ports are opened for your cPanel users.

By default, Ruby applications begin on port 12001. Ruby application port numbers are automatically incremented with each new Ruby application.

This means the the first Ruby on Rails application created on your server will use port 12001, while the second Ruby on Rails application will use port 12002.

Checking cpanel crontab user files.

Via root SSH access, either of the following commands may be used to list the contents:

# crontab -l -u username
# cat /var/spool/cron/username

usage: crontab

usage: crontab [-u user] file

crontab [-u user] { -e | -l | -r }
-e (edit user’s crontab)
-l (list user’s crontab)
-r (delete user’s crontab)
-i (prompt before deleting user’s crontab)

We can set up an automatic rsync and place the files into daily folders. For this to work we need to setup automatic ssh login first and then use cron to run your bash script.

The base of the automatic rsync is a very simple bash script.

#!/bin/bash
dest=/backup/buddy/`date +%A`
mkdir -p $dest
rsync -e ’ssh -p 2222′ -avl –delete –stats –progress root@192.168.1.1:/home/buddy $dest/

Using Cron to run the above script every day.

# run rsync at 23.00hrs every day
00 23 * * * sh /home/backup/bin/backup
SBDavid

NRPE

NRPE

NRPE allows you to remotely execute Nagios plugins on other Linux/Unix machines. This allows you to monitor remote machine metrics (disk usage, CPU load, etc.). NRPE can also communicate with Windows agent addons like NSClient++, so you can check metrics on remote Windows machines as well.

http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz

This is useful if you need to monitor local resources/attributes like disk usage, CPU load, memory usage, etc. on a remote host. Similiar functionality can be accomplished by using the check_by_ssh plugin, although it can impose a higher CPU load on the monitoring machine - especially if you are monitoring hundreds or thousands of hosts.

« Prev - Next »