Friday, December 14, 2012

How to set a crontab job for a perl script

In this tutorial I’m going describe how to set a crontab job for perl script on a linux system. The following example I'm going to demonstrate, how to  execute perl script every five minutes. below is the steps

[1] list the existing crontab using following command. If you have not set any crontab jobs it will display noting.
[shehan@localhost ~]$ crontab -l

crontab job

[2] issue following command to create a new crontab or edit previously created crontab 
[shehan@localhost ~]$ crontab -e

[3] add following line of code to crontab and don't forget to edit your perl script path.
*/5 means script will be executed every 5 minutes time , for ex :- 10.00 , 10.05 , 10.10 etc

*/5 * * * * perl /path/to/your/perlscript/

some tricky example
3-58/5 * * * * perl /path/to/your/perlscript/

This would still execute perl script every five minutes, but it would run on the 3's and 8's - e.g. 12:03, 12:08, 12:13, 12:18, etc.

[4]that's it !


How To Install Perl Modules Manually on linux

I  recently try out  perl script which is used to test download speed. when I run that script it gives me the following error saying that can’t locate Perl module called Time::Format .

Can't locate Time/ in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 ... )....

Can't locate Time/ in @INC

Solution for this error is install the perl module, in this case by installing the Time::Format perl module. below is most required steps to install any perl module.

[1] switch to root and launch the CPAN using following command
 [root@localhost ~]# perl -MCPAN -e shell

[2] type the module name according to below format, in this example I’m going to install Time::Format perl module.
cpan[1]> install Time::Format

[3] that’s all !! . now run your perl script again :)

Friday, November 30, 2012

How to install Redhat enterprise linux from usb drive

Installing Redhat Linux from DVD is not a huge task unless not going to customize for advance installation. However if you do same using USB drive ,you have some extra work to do. First time when I installed the Redhat Linux through USB drive I faced so many difficulties, so in this tutorial I'm going describe how I avoid those obstacle to made successful installation.

1) download and install "linux live usb creator" from this link

2) format the USB drive with FAT32. open that application and follow the steps mention on that application to create bootable usb drive. it's better un-tick the "Hide created file on key" from options. it will helpful to view all created files on the USB later.
you can test the USB using "mobalivecd" application. link is

3) I have faced the following error message in the middle of the installation

  Missing ISO 9660 Image

  The installer has tried to mount image #1, but cannot find it
  on the hard drive.
  Please copy this image to the drive and click Retry. Click
  Exit to abort the installation.

4) Solution for that error message is putting a redhat iso image into the USB drive.this is crazy but it's only solution i have found so far and it's worked :) .

rhel 6

5) Restart your pc and change boot method to USB

6) Follow Redhat installation steps. after you select the "install or upgrade an existing system" from the menu.
you may get a blinking cursor screen for 10 to 15 mins.pls be patient :-) .

7) Select "Language " , "key borad" according to your preference. once you got the "Redhat installation method" screen make sure to select "Hard drive"

Redhat Linux Installation Method

8) Click "ok" and then you get an screen similar to the following
 it will display all devices connected to your pc. for an example

/dev/sda1   <-- hard disk partition 1
/dev/sda2   <-- hard disk partition 2
/dev/sdb1   <-- USB drive

select your usb's depend on your system , according to above example it is /dev/sdb1 . and click "Ok" to continue.

select partition holds the installation image for red hat linux

9) Follow rest of the steps, and install the Redhat Linux !.

Wednesday, October 31, 2012

how to change default secureCRT appearance into Traditional color schemes

Default color scheme of SecureCRT is not eye friendly and if you work for long time with default color scheme your eye may be get tired . It is better to change color scheme into someting eye friendly. My suggestion is Traditional color schemes (Foreground is green and Background is black)

[1] Open the SecureCRT , click on " options " --> " Global options.. " . then you will get a window similar to the following

[2 ] select " General " --> " Default Session " --> " Edit Default Settings.. ", then you will have a window similar to the following

[3] Select " Appearance " --> and choose " Traditional "  form Current color schme drop down list . then click " OK " to apply the setting .

[4] Then SecureCRT prompt with a waring message like below, click " YES " and restart the SecureCRT

[5] SecureCRT color scheme is changed  , hooray !!!

how to add dvd based repository in rhel 6

Problem :- yum install [package..]    gives an error message similar to the following

[root@localhost ~]# yum install gcc
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
...(output ommited)
No package gcc available   <-- here i'm try to install pacakage called 'gcc'
Error: Nothing to do
[root@localhost ~]#

reason is we do not have access to RHN

Solution :- use DVD as base repository

[1]switch to the root

[shehan@localhost ~]$ su -
[root@localhost ~]#

[2]Create DVD based repo

[root@localhost ~]# vim /etc/yum.repos.d/iso.repo

Following text should be added to above file (iso.repo)


DVD based repository rhel 6

[3]mount installation DVD
make a directory called /mnt/cd and it should be similar to baseurl

[root@localhost ~]# mkdir /mnt/cd
[root@localhost ~]# mount /dev/cdrom /mnt/cd

[4]now try previous command again. it should work !
[root@localhost ~]# yum install gcc

tips :- How to  mount iso image ??
baseurl of  " iso.repo " file  should be changed as
file://mnt/iso/Server     ( I created /mnt/iso directory)

mount command is
mount -o loop /home/shehan/redhatiso/h-rel62x6.iso /mnt/iso

Related Posts