NOTES

1 >To find logs between time frame

#!/bin/sh
date1='Jul 15 2011 07:21:28'

date1_sec=$(date -d "$date1" '+%s')
date2_sec=$(date -d "$date1  5 min ago" '+%s')
while read line
do
        line_date=$(echo $line | awk '{print $1,$2,$3}')
        sec=$(date -d "$line_date" '+%s')
        if [ $date2_sec -le $sec -a $date1_sec -ge $sec ]
        then
                echo $line
        fi
done < /var/log/messages

2> PERL INSTALLATION

a)perl -MCPAN -e shell
install Class::Data::Inheritable
instmodsh


b)Perl Installation

tar -zvxf perl-5.8.8.tar.gz

./Configure -des -Dprefix=/home/nagios/apache/perl

wget http://search.cpan.org/CPAN/authors/id/O/OL/OLAF/Net-DNS-0.67.tar.gz


c)wget http://www.cpan.org/authors/id/T/TM/TMTM/Class-Data-Inheritable-0.08.tar.gz
ls
tar -xf Class-Data-Inheritable-0.08.tar.gz
ls
cd Class-Data-Inheritable-0.08
ls
less README
perl Makefile.PL
make
make test
make install
cd
instmodsh

How to check the version of perl?
perl -MRedis -le 'print $Redis::VERSION'

perl -MDate::Manip   -e 'print "$Date::Manip::VERSION\n"'



apt-cache search libpq
dpkg-query --list | grep libpq

RSYNC



Process to create rsync server.

1.First create rsync demon configuration file named rsyncd.conf

2. Now add the below line in it.

motd file = /etc/rsyncd.motd
[workspace]
path = /home/username/workspace
comment = This is the path to my Eclipse workspace (on the server)
uid = username
gid = username
read only = false
auth users = username
secrets file = /etc/rsyncd.scrt


username = username of your server not the user of your client.
workspace = whaterver path you want to sync , this path can go anywhere we want to sync out files to.

Needed more two otherfile /etc/rsyncd.motd and /etc/rsyncd.scrt.This should be created as like /etc/rsyncd.conf
/etc/rsyncd.motd == Message of the day.This contecnt of the file is displayed by the server when a client connects.

/etc/rsyncd.scrt == File contains username and password pairs.

username:whatever_password_you_want

username= username should be username in our server.


Now you should have all the configuration information necessary, all that’s left to do is open the rsync port and start the daemon.

To open the port, open the /etc/default/rsync file, i.e.,

you@your-computer:~$ sudo gedit /etc/default/rsync

and set RSYNC_ENABLE=true.

Now to start the daemon,

you@your-computer:~$ sudo /etc/init.d/rsync restart

There you have it, your rsync server should be up and running!


Example

rsync -vr /home/hari/abc/* SRC hari@192.168.153.128::documents



Here is my configuration of rsyncd.conf on the server side.


[documents]
 path = /home/hari/Documents
 comment = The documents folder of Juan
 uid = hari
 gid = hari
 read only = no
 list = yes
 auth users = hari
 secrets file = /etc/rsyncd.secrets
 hosts allow = 192.168.153.0/255.255.255.0








Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s