Thursday, January 17, 2013
rc.local script in Opensuse 11.
If you have commands and you wanted that while boot. In RHEL/CENTOS /etc/rc.d/rc.local but the same file is not exists in Opensue by default you have to create that using following steps.
Create the file /etc/rc.d/rclocal
# file content #! /bin/sh
## This script simulates redhat's rc.local (Add commands at the end)
### BEGIN INIT INFO
# Provides: rclocal
# Required-Start: $local_fs $remote_fs $network
# X-UnitedLinux-Should-Start: $ALL
# Required-Stop:
# X-UnitedLinux-Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Simulates rc.local
# Description: Simulates redhat's rc.local: contains
# commands to execute after system has booted (all services are already
# available)
### END INIT INFO
## Execute ony when service is started
case "$1" in
start)
## commands will be executed
;;
*)
exit 0
;;
esac
-----------------------------------------------------------------------------------------
Do give right permission for executable using command : chmod 777 /etc/rc.d/rclocal
Create symlink if you want ln -s /etc/rc.d/rclocal /etc/rc.d/rc.local
You have to Enable that service in Yast2 from command prompt, using this command.
yast2 > System > Runlevel editor > rclocal > Enable
Now you can edit file /etc/rc.d/rc.local add your command in script at "case $1".
Reboot and check..! Its done.!
Wednesday, January 16, 2013
Error reading block 2851259 (Invalid argument) while doing inode scan. Ignore error? yes Force rewrite? yes
If you are facing following error while shrink LVM using lvreduce command.
Error reading block 2851259 (Invalid argument) while doing inode scan. Ignore error? yes
Force rewrite? yes
It means if you trying to reduce the lvm partition the partition may be corrupt.
So you can do this step by step.
[root@localhost /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/data--vg-data 14G 154M 13G 2% /data
## If you reduceing the LVM 4GB you using.
[root@localhost ~]# e2fsck -f /dev/data-vg/data
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
The filesystem size (according to the superblock) is 3670016 blocks
The physical size of the device is 2621440 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort? yes
## Extend LVM with the original size.
lvextend -L+4G /dev/mapper/data--vg-data
### Try to resize again.
## mount that filesystem.
[root@localhost ~]# mount /dev/data-vg/data /data/
### check again.
[root@localhost /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/data--vg-data 14G 154M 13G 2% /data
### Take a backup of data with snapshot (create snapshot with minimum size of data.) and mount to
## system.
[root@localhost /]# lvcreate -L9G -s -n snap-data /dev/data-vg/data
Logical volume "snap-data" created
[root@localhost /]# mount /dev/data-vg/snap-data /snap/
[root@localhost /]# df /snap/
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/data--vg-snap--data 14449712 156824 13558888 2% /snap
[root@localhost /]# cd /snap/
[root@localhost snap]# ls -la
total 60
drwxr-xr-x 4 root root 4096 Jan 16 16:38 .
drwxr-xr-x 34 root root 4096 Jan 7 18:22 ..
-rw-r--r-- 1 root root 21 Jan 16 16:37 file
-rw-r--r-- 1 root root 21 Jan 16 16:38 file1
-rw-r--r-- 1 root root 21 Jan 16 16:38 file2
drwx------ 2 root root 16384 Jan 16 16:34 lost+found
drwxr-xr-x 2 root root 4096 Jan 16 16:39 yo
### Now you can umount data partition and reduce the original "data" partition, remount the /data and move the snapshot backup to /data partition.
Guys, any query please let me know.
Error reading block 2851259 (Invalid argument) while doing inode scan. Ignore error
Force rewrite
It means if you trying to reduce the lvm partition the partition may be corrupt.
So you can do this step by step.
[root@localhost /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/data--vg-data 14G 154M 13G 2% /data
## If you reduceing the LVM 4GB you using.
lvreduce -L -4G /dev/data-vg/data
[root@localhost ~]# e2fsck -f /dev/data-vg/data
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
The filesystem size (according to the superblock) is 3670016 blocks
The physical size of the device is 2621440 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort
## Extend LVM with the original size.
lvextend -L+4G /dev/mapper/data--vg-data
## Recheck the Partition.
e2fsck -f /dev/data-vg/data
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/data-vg/data: 18/1835008 files (5.6% non-contiguous), 96794/3670016 blocks
### Try to resize again.
[root@localhost ~]# resize2fs -p /dev/mapper/data--vg-data
resize2fs 1.39 (29-May-2006)
The filesystem is already 3670016 blocks long. Nothing to do!
## mount that filesystem.
[root@localhost ~]# mount /dev/data-vg/data /data/
### check again.
[root@localhost /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/data--vg-data 14G 154M 13G 2% /data
### Take a backup of data with snapshot (create snapshot with minimum size of data.) and mount to
## system.
[root@localhost /]# lvcreate -L9G -s -n snap-data /dev/data-vg/data
Logical volume "snap-data" created
[root@localhost /]# mount /dev/data-vg/snap-data /snap/
[root@localhost /]# df /snap/
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/data--vg-snap--data 14449712 156824 13558888 2% /snap
[root@localhost /]# cd /snap/
[root@localhost snap]# ls -la
total 60
drwxr-xr-x 4 root root 4096 Jan 16 16:38 .
drwxr-xr-x 34 root root 4096 Jan 7 18:22 ..
-rw-r--r-- 1 root root 21 Jan 16 16:37 file
-rw-r--r-- 1 root root 21 Jan 16 16:38 file1
-rw-r--r-- 1 root root 21 Jan 16 16:38 file2
drwx------ 2 root root 16384 Jan 16 16:34 lost+found
drwxr-xr-x 2 root root 4096 Jan 16 16:39 yo
### Now you can umount data partition and reduce the original "data" partition, remount the /data and move the snapshot backup to /data partition.
Guys, any query please let me know.
Friday, October 26, 2012
[ERROR] Can't start server : Bind on unix socket: Permission denied
chown mysql:mysql /var/lib/mysql
chown mysql:mysql /var/lib/mysql/*
chmod 660 /var/lib/mysql/*
chown mysql:mysql /var/lib/mysql/mysql
chmod 700 /var/lib/mysql/mysql
chown mysql:mysql /var/lib/mysql/mysql/*
chmod 660 /var/lib/mysql/mysql/
restorecon -Rv /var/lib/mysql
chown mysql:mysql /var/lib/mysql/*
chmod 660 /var/lib/mysql/*
chown mysql:mysql /var/lib/mysql/mysql
chmod 700 /var/lib/mysql/mysql
chown mysql:mysql /var/lib/mysql/mysql/*
chmod 660 /var/lib/mysql/mysql/
restorecon -Rv /var/lib/mysql
Tuesday, October 16, 2012
How To Setup Iptables On Centos/RHEL
Copy this in file
: /etc/sysconfig/iptables
------------------------------------------------------------------------------
# Generated by iptables-save v1.3.5 on Thu Aug 30 16:57:39 2012
*filter
:INPUT ACCEPT [28:1620]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1359:3919374]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp -m icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p esp -j ACCEPT
-A RH-Firewall-1-INPUT -p ah -j ACCEPT
-A RH-Firewall-1-INPUT -d 224.0.0.251 -p udp -m udp --dport 5353 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
#-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
#-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A RH-Firewall-1-INPUT -s 10.0.12.0 -p tcp -m tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -s 99.22.344.21 -p tcp -m tcp --dport 21 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
---------------------------------------------------------------------------------
Restart the Service:
/etc/init.d/iptables start
: /etc/sysconfig/iptables
------------------------------------------------------------------------------
# Generated by iptables-save v1.3.5 on Thu Aug 30 16:57:39 2012
*filter
:INPUT ACCEPT [28:1620]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1359:3919374]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp -m icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p esp -j ACCEPT
-A RH-Firewall-1-INPUT -p ah -j ACCEPT
-A RH-Firewall-1-INPUT -d 224.0.0.251 -p udp -m udp --dport 5353 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
#-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
#-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A RH-Firewall-1-INPUT -s 10.0.12.0 -p tcp -m tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -s 99.22.344.21 -p tcp -m tcp --dport 21 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
---------------------------------------------------------------------------------
Restart the Service:
/etc/init.d/iptables start
Thursday, August 16, 2012
How to disable Iptable on Ubuntu.
How to disable iptables on Ubuntu.
Sudo ufw disable
After that check:
ipatables -L
Sudo ufw disable
After that check:
ipatables -L
Wednesday, August 15, 2012
How to secure/encrypt the shell script.!
If you wanted to encrypt the shell script, Or you need to do secure the shell script. Please use this tool.
Install with (binary) source.
# wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.7.tgz
# tar xvfz shc-3.8.7.tgz
# cd shc-3.8.7
# make
Or
Install with Yum repository.
yum install shc -y
Run the script with sevral options.
$ ./shc -v
shc parse(-f): No source file specified
shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script
Create the test shell script.
--------------------------
#! /bin/bash
echo " Hey Hello.!"
--------------------------
If installed with yum please do this
$ shc -f filename.sh
After run this command you will find two more file with the name as follows.
Original file : filename.sh
C compile file : filename.x.c
Encripted File: filename.x
And if you run the command like:
$./filename.x
o/p: Hey Hello.!
Install with (binary) source.
# wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.7.tgz
# tar xvfz shc-3.8.7.tgz
# cd shc-3.8.7
# make
Or
Install with Yum repository.
yum install shc -y
Run the script with sevral options.
$ ./shc -v
shc parse(-f): No source file specified
shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script
Create the test shell script.
--------------------------
#! /bin/bash
echo " Hey Hello.!"
--------------------------
If installed with yum please do this
$ shc -f filename.sh
After run this command you will find two more file with the name as follows.
Original file : filename.sh
C compile file : filename.x.c
Encripted File: filename.x
And if you run the command like:
$./filename.x
o/p: Hey Hello.!
Thursday, August 9, 2012
ossl_ssl.c:110:1: error: ‘SSLv2_method’ undeclared here (not in a function)
When building any ruby verison on Ubuntu, If you got following error:
_________________________________________________________________
Error:
ossl_ssl.c:110:1: error: ‘SSLv2_method’ undeclared here (not in a function)
ossl_ssl.c:111:1: error: ‘SSLv2_server_method’ undeclared here (not in a function)
ossl_ssl.c:112:1: error: ‘SSLv2_client_method’ undeclared here (not in a function)
make[1]: *** [ossl_ssl.o] Error 1
make[1]: Leaving directory `/home/shrii/.rvm/src/ruby-1.9.2-p180/ext/openssl’
make: *** [mkmain.sh] Error 1
_________________________________________________________________
Please do this :
sudo rvm pkg install openssl
sudo rvm install ruby-1.9.2-p180 –with-openssl-dir=$rvm_path/usr
Resolved.!
_________________________________________________________________
Error:
ossl_ssl.c:110:1: error: ‘SSLv2_method’ undeclared here (not in a function)
ossl_ssl.c:111:1: error: ‘SSLv2_server_method’ undeclared here (not in a function)
ossl_ssl.c:112:1: error: ‘SSLv2_client_method’ undeclared here (not in a function)
make[1]: *** [ossl_ssl.o] Error 1
make[1]: Leaving directory `/home/shrii/.rvm/src/ruby-1.9.2-p180/ext/openssl’
make: *** [mkmain.sh] Error 1
_________________________________________________________________
Please do this :
sudo rvm pkg install openssl
sudo rvm install ruby-1.9.2-p180 –with-openssl-dir=$rvm_path/usr
Resolved.!
Depends: libc6-i386 (>= 2.7) but it is not going to be installed
Hi Guys,
If you are trying to install any application on ubuntu and face this type of error:
-------------------------------------------------------------------------------------
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
teamviewer7 : Depends: libc6-i386 (>= 2.7) but it is not going to be installed
Depends: lib32asound2 but it is not going to be installed
Depends: lib32z1 but it is not going to be installed
Depends: ia32-libs but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)
--------------------------------------------------------------------------------------
It manse you not able to install any package till resolve the dependency.
And the Solution is as follows : So right now error for package teamviewer7
apt-get purge teamviewer7
Resolved.!
If you are trying to install any application on ubuntu and face this type of error:
-------------------------------------------------------------------------------------
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
teamviewer7 : Depends: libc6-i386 (>= 2.7) but it is not going to be installed
Depends: lib32asound2 but it is not going to be installed
Depends: lib32z1 but it is not going to be installed
Depends: ia32-libs but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)
--------------------------------------------------------------------------------------
It manse you not able to install any package till resolve the dependency.
And the Solution is as follows : So right now error for package teamviewer7
apt-get purge teamviewer7
Resolved.!
Thursday, June 14, 2012
How to change default SMTP 25 port in postfix on CentOs?
How to change default SMTP 25 port in postfix on CentOs?
Check and open master.cf
vi /etc/postfix/master.cf
-------------------------------------------------------------------
#Comment default line as below.
#smtp inet n - n - - smtpd
#Add new line with port as you like as below.
9485 inet n - n - - smtpd
-------------------------------------------------------------------
Then you need to restart postfix service.
/etc/init.d/postfix restart
And configue you SMTP as
Hostname Port no Username Password
SMTP.domain.com 9485 abc passwd
Thats it.!
Check and open master.cf
vi /etc/postfix/master.cf
-------------------------------------------------------------------
#Comment default line as below.
#smtp inet n - n - - smtpd
#Add new line with port as you like as below.
9485 inet n - n - - smtpd
-------------------------------------------------------------------
Then you need to restart postfix service.
/etc/init.d/postfix restart
And configue you SMTP as
Hostname Port no Username Password
SMTP.domain.com 9485 abc passwd
Thats it.!
Saturday, June 2, 2012
FiGlet is (figlet) text font for linux.!
FiGlet is (figlet) text font for linux
FIGlet is a computer program that generates text banners, in a variety of.. It used for Display Large Colourful Text Banner On Screen in linux.
Figlets are often used in email signatures. We also use them for commenting source code when programming
http://www.figlet.org/
wget http://www.jave.de/figlet/figletfonts40.zip
http://www.figlet.org/examples.html
http://www.0xcb0.com/2010/01/14/using-figlet-to-pimp-your-scripts/
[root@localhost fonts]# figlet Fearless -f bell
.____ .
/ ___ ___ .___ | ___ ____ ____
|__. .' ` / ` / \ | .' ` ( (
| |----' | | | ' | |----' `--. `--.
/ `.___, `.__/| / /\__ `.___, \___.' \___.'
[root@localhost proddb]# figlet Fearless
_____ _
| ___|__ __ _ _ __| | ___ ___ ___
| |_ / _ \/ _` | '__| |/ _ \/ __/ __|
| _| __/ (_| | | | | __/\__ \__ \
|_| \___|\__,_|_| |_|\___||___/___/
So basically you can use simply like this:
[root@localhost ]# figlet Fearless -f
Go Rocks..! @ Linux Administration Blog.!
FIGlet is a computer program that generates text banners, in a variety of.. It used for Display Large Colourful Text Banner On Screen in linux.
Figlets are often used in email signatures. We also use them for commenting source code when programming
http://www.figlet.org/
wget http://www.jave.de/figlet/figletfonts40.zip
http://www.figlet.org/examples.html
http://www.0xcb0.com/2010/01/14/using-figlet-to-pimp-your-scripts/
[root@localhost fonts]# figlet Fearless -f bell
.____ .
/ ___ ___ .___ | ___ ____ ____
|__. .' ` / ` / \ | .' ` ( (
| |----' | | | ' | |----' `--. `--.
/ `.___, `.__/| / /\__ `.___, \___.' \___.'
[root@localhost proddb]# figlet Fearless
_____ _
| ___|__ __ _ _ __| | ___ ___ ___
| |_ / _ \/ _` | '__| |/ _ \/ __/ __|
| _| __/ (_| | | | | __/\__ \__ \
|_| \___|\__,_|_| |_|\___||___/___/
So basically you can use simply like this:
[root@localhost ]# figlet Fearless -f
Go Rocks..!
Thursday, May 17, 2012
Why Is My Emails Getting As Spam?
Why Is My Emails Getting As Spam?
Check above things.
First we need to check Email Headers.
1. Return Path
2. To
3. From
4. We should not use CAPS because not only being unprofessional, but it
also triggers spam filters. To land in the Spam folder consistently,
please do not USE ALL CAPS IN THE SUBJECT LINE AND THE BODY FROM TO and
Excessive punctuation (e.g. -/, ;^%#$@+ * "').
E.g. as follows.
1. Email "From : ADMIN ENROLL" getting
spam in gmail.com sometimes and if we not change it will increasing
count.
2. Email "From: noreply@exmaple.com" it
getting in mailbox, check the CAPS deference.
http://php.net/manual/en/function.mail.php
http://www.niso.org/khelp/kmlm/user_help/html/examine_mail_headers.html
Please check this too. It can be understand better. :)
http://www.infusionblog.com/email-marketing/7-ways-for-your-email-to-land-in-the-spam-folder/
Check SPF for Domain.:
http://www.microsoft.com/mscorp/safety/content/technologies/senderid/wizard/
What is SPF records and How to setup?
http://www.kazeli.com/help/index.cfm?pageloc=quest&questid=435&catid=337,338
To diagnose the mail. Why its going in Spam.
Check tool:
http://mxtoolbox.com/
Here you can check following points
1. Mxlookup : For your domain and ip
2. Blacklist : For your IP
3. Diagnostics : SMTP Diagnostics, check your mail server
4. Analyze Headers : Check your mail headers.
5. SPF Records : Check your Sender Policy Framework
7. DNS Lookup : Check your Domain lookup.
If you check above all things your mail will not go in Spam.!
@Linux Administration Blog.!
Check above things.
First we need to check Email Headers.
1. Return Path
2. To
3. From
4. We should not use CAPS because not only being unprofessional, but it
also triggers spam filters. To land in the Spam folder consistently,
please do not USE ALL CAPS IN THE SUBJECT LINE AND THE BODY FROM TO and
Excessive punctuation (e.g. -/, ;^%#$@+ * "').
E.g. as follows.
1. Email "From : ADMIN ENROLL
spam in gmail.com sometimes and if we not change it will increasing
count.
2. Email "From: noreply@exmaple.com" it
getting in mailbox, check the CAPS deference.
http://php.net/manual/en/function.mail.php
http://www.niso.org/khelp/kmlm/user_help/html/examine_mail_headers.html
Please check this too. It can be understand better. :)
http://www.infusionblog.com/email-marketing/7-ways-for-your-email-to-land-in-the-spam-folder/
Check SPF for Domain.:
http://www.microsoft.com/mscorp/safety/content/technologies/senderid/wizard/
What is SPF records and How to setup?
http://www.kazeli.com/help/index.cfm?pageloc=quest&questid=435&catid=337,338
To diagnose the mail. Why its going in Spam.
Check tool:
http://mxtoolbox.com/
Here you can check following points
1. Mxlookup : For your domain and ip
2. Blacklist : For your IP
3. Diagnostics : SMTP Diagnostics, check your mail server
4. Analyze Headers : Check your mail headers.
5. SPF Records : Check your Sender Policy Framework
7. DNS Lookup : Check your Domain lookup.
If you check above all things your mail will not go in Spam.!
@Linux Administration Blog.!
Wednesday, May 16, 2012
ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number
mysql> GRANT SELECT ON *.* TO 'gita'@'localhost' IDENTIFIED BY PASSWORD "gita123";
ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number
# Check encripted password on Mysql Console.
mysql> select password('gita123');
+---------------------+
| password('gita123') |
+---------------------+
| 1f6f58c9269d50dc |
+---------------------+
1 row in set (0.00 sec)
# Check Grant for User
mysql> show grants for gita@192.168.10.143;
+-----------------------------------------------------------------------------------------------------+
| Grants for gita@192.168.10.143 |
+-----------------------------------------------------------------------------------------------------+
| GRANT SELECT, SHOW VIEW ON *.* TO 'gita'@'192.168.10.143' IDENTIFIED BY PASSWORD '1f6f58c9269d50dc' |
| GRANT SELECT, SHOW VIEW ON `data1`.* TO 'gita'@'192.168.10.143' |
| GRANT SELECT, SHOW VIEW ON `data2`.* TO 'gita'@'192.168.10.143' |
+-----------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)
# Update Password In Query.
mysql> GRANT SELECT ON *.* TO 'gita'@'localhost' IDENTIFIED BY PASSWORD '1f6f58c9269d50dc';
Query OK, 0 rows affected (0.04 sec)
Resolved.!
ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number
# Check encripted password on Mysql Console.
mysql> select password('gita123');
+---------------------+
| password('gita123') |
+---------------------+
| 1f6f58c9269d50dc |
+---------------------+
1 row in set (0.00 sec)
# Check Grant for User
mysql> show grants for gita@192.168.10.143;
+-----------------------------------------------------------------------------------------------------+
| Grants for gita@192.168.10.143 |
+-----------------------------------------------------------------------------------------------------+
| GRANT SELECT, SHOW VIEW ON *.* TO 'gita'@'192.168.10.143' IDENTIFIED BY PASSWORD '1f6f58c9269d50dc' |
| GRANT SELECT, SHOW VIEW ON `data1`.* TO 'gita'@'192.168.10.143' |
| GRANT SELECT, SHOW VIEW ON `data2`.* TO 'gita'@'192.168.10.143' |
+-----------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)
# Update Password In Query.
mysql> GRANT SELECT ON *.* TO 'gita'@'localhost' IDENTIFIED BY PASSWORD '1f6f58c9269d50dc';
Query OK, 0 rows affected (0.04 sec)
Resolved.!
Thursday, May 3, 2012
Auto Scaling On Amazon Cloud Computing.
First check the URL to understand Auto Scaling http://aws.amazon.com/autoscaling/
And download Auto Scaling developer tool http://aws.amazon.com/developertools/2535
After download follow the stapes:
unzip AutoScaling-2011-01-01.zip
cd AutoScaling-1.0.49.1/
Set the enviroment in /root/.bashrc on your box.
------------------------------------------------------------------------
export AWS_AUTO_SCALING_HOME=/opt/AutoScaling-1.0.49.1/
set AWS_AUTO_SCALING_HOME=/opt/AutoScaling-1.0.49.1/
export PATH=$PATH:$AWS_AUTO_SCALING_HOME/bin
set PATH=%AWS_AUTO_SCALING_HOME%/bin
export AWS_AUTO_SCALING_URL=https://autoscaling.ap-southeast-1.amazonaws.com
set AWS_AUTO_SCALING_URL=https://autoscaling.ap-southeast-1.amazonaws.com
------------------------------------------------------------------------
You need to be using an elastic load balancer to configure auto scaling. Configuring autoscaling consists of three steps:
1) Create launch configuration
2) Create auto scaling group
3) Create auto scaling trigger
Create launch configuration
Launch configuration provides information about the instance to be launched. You can see that an AMI, instance type, availability zone and security groups are specified when a launch configuration is created.
as-create-launch-config MY_Group --image-id ami-a2b7f3f0 --instance-type m1.small -I Your_access_key -S Your_Secret_key
Create autoscaling group
A launch configuration is attached with an autoscaling group. The group consists of pool of instances. You can specify minimum and maximum size of the pool.
as-create-auto-scaling-group sbsgroup --launch-configuration MY_Group --availability-zones ap-southeast-1b --min-size 1 --max-size 10 --desired-capacity 1 -I Your_access_key -S Your_Secret_key
To check
as-describe-auto-scaling-groups sbsgroup --headers -I Your_access_key -S Your_Secret_key
----------------------------------------------------------------
Output:
AUTO-SCALING-GROUP GROUP-NAME LAUNCH-CONFIG AVAILABILITY-ZONES MIN-SIZE MAX-SIZE DESIRED-CAPACITY
AUTO-SCALING-GROUP sbsgroup MY_Group ap-southeast-1b 1 10 1
INSTANCE INSTANCE-ID AVAILABILITY-ZONE STATE STATUS LAUNCH-CONFIG
INSTANCE i-e6d671b2 ap-southeast-1b InService Healthy MY_Group
-----------------------------------------------------------------
Create autoscaling trigger
The trigger defines the conditions to start or stop ec2 instances. For example:
as-create-or-update-trigger my-latency-trigger --auto-scaling-group sbsgroup --dimensions "LoadBalancerName=myloadbalancer" --measure Latency --period 60 --statistic Average --lower-threshold 0.25 --upper-threshold 0.75 --breach-duration 300 --lower-breach-increment=-1 --upper-breach-increment 1 --namespace "AWS/ELB" --unit Seconds
Now, we have created a latency trigger with 0.25 as the lower threshold and 0.75 seconds as the upper threshold. If your website latency goes beyond 0.75 seconds, this trigger will be activated and hence an instance will be launched (as specified by upper breach increment).
Its Done.! @ Linux Administration Blog.!
And download Auto Scaling developer tool http://aws.amazon.com/developertools/2535
After download follow the stapes:
unzip AutoScaling-2011-01-01.zip
cd AutoScaling-1.0.49.1/
Set the enviroment in /root/.bashrc on your box.
------------------------------------------------------------------------
export AWS_AUTO_SCALING_HOME=/opt/AutoScaling-1.0.49.1/
set AWS_AUTO_SCALING_HOME=/opt/AutoScaling-1.0.49.1/
export PATH=$PATH:$AWS_AUTO_SCALING_HOME/bin
set PATH=%AWS_AUTO_SCALING_HOME%/bin
export AWS_AUTO_SCALING_URL=https://autoscaling.ap-southeast-1.amazonaws.com
set AWS_AUTO_SCALING_URL=https://autoscaling.ap-southeast-1.amazonaws.com
------------------------------------------------------------------------
You need to be using an elastic load balancer to configure auto scaling. Configuring autoscaling consists of three steps:
1) Create launch configuration
2) Create auto scaling group
3) Create auto scaling trigger
Create launch configuration
Launch configuration provides information about the instance to be launched. You can see that an AMI, instance type, availability zone and security groups are specified when a launch configuration is created.
as-create-launch-config MY_Group --image-id ami-a2b7f3f0 --instance-type m1.small -I Your_access_key -S Your_Secret_key
Create autoscaling group
A launch configuration is attached with an autoscaling group. The group consists of pool of instances. You can specify minimum and maximum size of the pool.
as-create-auto-scaling-group sbsgroup --launch-configuration MY_Group --availability-zones ap-southeast-1b --min-size 1 --max-size 10 --desired-capacity 1 -I Your_access_key -S Your_Secret_key
To check
as-describe-auto-scaling-groups sbsgroup --headers -I Your_access_key -S Your_Secret_key
----------------------------------------------------------------
Output:
AUTO-SCALING-GROUP GROUP-NAME LAUNCH-CONFIG AVAILABILITY-ZONES MIN-SIZE MAX-SIZE DESIRED-CAPACITY
AUTO-SCALING-GROUP sbsgroup MY_Group ap-southeast-1b 1 10 1
INSTANCE INSTANCE-ID AVAILABILITY-ZONE STATE STATUS LAUNCH-CONFIG
INSTANCE i-e6d671b2 ap-southeast-1b InService Healthy MY_Group
-----------------------------------------------------------------
Create autoscaling trigger
The trigger defines the conditions to start or stop ec2 instances. For example:
as-create-or-update-trigger my-latency-trigger --auto-scaling-group sbsgroup --dimensions "LoadBalancerName=myloadbalancer" --measure Latency --period 60 --statistic Average --lower-threshold 0.25 --upper-threshold 0.75 --breach-duration 300 --lower-breach-increment=-1 --upper-breach-increment 1 --namespace "AWS/ELB" --unit Seconds
Now, we have created a latency trigger with 0.25 as the lower threshold and 0.75 seconds as the upper threshold. If your website latency goes beyond 0.75 seconds, this trigger will be activated and hence an instance will be launched (as specified by upper breach increment).
Its Done.! @ Linux Administration Blog.!
Monday, April 16, 2012
Use Delimiter In Awk and Cut.
We can use delimiter in Awk, if you exported domain list from godaddy and you want only domain name rather than full information then you can use this command to get domain list only.
Using this:
awk -F "," '{print $1}'
Or
cut '--delimiter= ' -f1
E.g.
cat DomainDownloadList-124696210.csv | awk '{ printf " %s\n", $1 }' | awk -F "," '{print $1}' > domainlist.txt
Or
cat DomainDownloadList-124696210.csv | cut '--delimiter= ' -f1 > domainlist.txt
For word count for counting domain :
cat DomainDownloadList-124696210.csv | awk '{ printf " %s\n", $1 }' | awk -F "," '{print $1}' | wc
Or
cat DomainDownloadList-124696210.csv | cut '--delimiter= ' -f1 | wc
@ Linux Administration Blog.!
Using this:
awk -F "," '{print $1}'
Or
cut '--delimiter= ' -f1
E.g.
cat DomainDownloadList-124696210.csv | awk '{ printf " %s\n", $1 }' | awk -F "," '{print $1}' > domainlist.txt
Or
cat DomainDownloadList-124696210.csv | cut '--delimiter= ' -f1 > domainlist.txt
For word count for counting domain :
cat DomainDownloadList-124696210.csv | awk '{ printf " %s\n", $1 }' | awk -F "," '{print $1}' | wc
Or
cat DomainDownloadList-124696210.csv | cut '--delimiter= ' -f1 | wc
@ Linux Administration Blog.!
Tuesday, April 10, 2012
Application Deployment Guide.
@ Linux Administration Blog.!
Monday, April 9, 2012
How to replicate only one table from mysql database.
Install Ruby 1.9.2
Install gem rubyrep (1.2.0) using command
gem install rubyrep
Then create conf file with name /etc/myrubyrep.conf and with following content.
-------------------------------------------------------------
RR::Initializer::run do |config|
config.left = {
:adapter => 'mysql', # or 'pgsql'
:database => 'c11',
:username => 'root',
:password => '',
:socket => '/var/lib/mysql/mysql.sock'
}
config.right = {
:adapter => 'mysql', # or 'pgsql'
:database => 'c12',
:username => 'root',
:password => '',
:socket => '/var/lib/mysql/mysql.sock'
}
config.include_tables 'table name' # e.g. 'email_list_subscribers' only this will replicate
#config.include_tables /^e/ # regexp matches all tables starting with e
# config.include_tables /./ # regexp matches all tables
#config.options[:auto_key_limit] = 2
end
---------------------------------------------
Using this command you can replicate only one table from database.
[root@localhost ]# rubyrep replicate -c /etc/myrubyrep.conf
Verifying RubyRep tables
Checking for and removing rubyrep triggers from unconfigured tables
Verifying rubyrep triggers of configured tables
Starting replication..
For only scan and sync to check status use following commands:
[root@localhost tmp]# rubyrep scan -c /etc/myrubyrep.conf
email_list_subscribers 100% ......................... 0
[root@localhost tmp]# rubyrep sync -c /etc/myrubyrep.conf
email_list_subscribers 100% ......................... 0
If modified it will change to 0 to 1.
Cool thing... Please let me know if you guys have any questions.
@ Linux Administration Blog.!
Install gem rubyrep (1.2.0) using command
gem install rubyrep
Then create conf file with name /etc/myrubyrep.conf and with following content.
-------------------------------------------------------------
RR::Initializer::run do |config|
config.left = {
:adapter => 'mysql', # or 'pgsql'
:database => 'c11',
:username => 'root',
:password => '',
:socket => '/var/lib/mysql/mysql.sock'
}
config.right = {
:adapter => 'mysql', # or 'pgsql'
:database => 'c12',
:username => 'root',
:password => '',
:socket => '/var/lib/mysql/mysql.sock'
}
config.include_tables 'table name' # e.g. 'email_list_subscribers' only this will replicate
#config.include_tables /^e/ # regexp matches all tables starting with e
# config.include_tables /./ # regexp matches all tables
#config.options[:auto_key_limit] = 2
end
---------------------------------------------
Using this command you can replicate only one table from database.
[root@localhost ]# rubyrep replicate -c /etc/myrubyrep.conf
Verifying RubyRep tables
Checking for and removing rubyrep triggers from unconfigured tables
Verifying rubyrep triggers of configured tables
Starting replication..
For only scan and sync to check status use following commands:
[root@localhost tmp]# rubyrep scan -c /etc/myrubyrep.conf
email_list_subscribers 100% ......................... 0
[root@localhost tmp]# rubyrep sync -c /etc/myrubyrep.conf
email_list_subscribers 100% ......................... 0
If modified it will change to 0 to 1.
Cool thing... Please let me know if you guys have any questions.
@ Linux Administration Blog.!
Wednesday, January 11, 2012
Benchmarking with Frameworks.
Framework for Development.
Ruby:
1.Ruby on Rails is on the TOP.
PHP:
2.FuelPHP fuelphp.com for the perfect mixture of CI, Kohana, Rails and others.
If you check following URL:
http://ilikekillnerds.com/2011/04/codeigniter-vs-fuelphp
http://www.reddit.com/r/webdev/comments/fmy6i/why_is_fuelphp_better_than_codeigniter/
http://www.beyondcoding.com/2008/05/26/ruby-on-rails-passenger-modrails-vs-codeigniter-and-kohana/
Thanks-
Shrii
Ruby:
1.Ruby on Rails is on the TOP.
PHP:
2.FuelPHP fuelphp.com for the perfect mixture of CI, Kohana, Rails and others.
If you check following URL:
http://ilikekillnerds.com/2011/04/codeigniter-vs-fuelphp
http://www.reddit.com/r/webdev/comments/fmy6i/why_is_fuelphp_better_than_codeigniter/
http://www.beyondcoding.com/2008/05/26/ruby-on-rails-passenger-modrails-vs-codeigniter-and-kohana/
Thanks-
Shrii
Tuesday, January 3, 2012
SMTP check script in ruby.
Create ruby script to check SMTP with login credential.
You can test two authentication in this script i.e. plain and login.
vi /opt/rubymailtest.rb
require 'net/smtp'
message = <
From: info@homework.do
To: sbtoalerts@gmail.com
Subject: test message
Date: Sat, 23 Jun 2001 16:26:43 +0900
This is a test message.
END_OF_MESSAGE
#Net::SMTP.start('mail.exmaple.com') do |smtp|
# smtp.send_message message, 'info@homework.do',
# 'sbtoalerts@gmail.com'
# PLAIN
#Net::SMTP.start('mail.example.com', 25, 'mail.example.com',
# 'Your Account', 'Your Password', :plain)
# LOGIN
Net::SMTP.start('mail.example.com', 25, 'mail.example.com', 'username', 'passwd', :login) do |smtp|
smtp.send_message message, 'info@homework.do',
'sbtoalerts@gmail.com'
#puts " done"
end
You can test two authentication in this script i.e. plain and login.
vi /opt/rubymailtest.rb
require 'net/smtp'
message = <
From: info@homework.do
To: sbtoalerts@gmail.com
Subject: test message
Date: Sat, 23 Jun 2001 16:26:43 +0900
This is a test message.
END_OF_MESSAGE
#Net::SMTP.start('mail.exmaple.com') do |smtp|
# smtp.send_message message, 'info@homework.do',
# 'sbtoalerts@gmail.com'
# PLAIN
#Net::SMTP.start('mail.example.com', 25, 'mail.example.com',
# 'Your Account', 'Your Password', :plain)
# LOGIN
Net::SMTP.start('mail.example.com', 25, 'mail.example.com', 'username', 'passwd', :login) do |smtp|
smtp.send_message message, 'info@homework.do',
'sbtoalerts@gmail.com'
#puts " done"
end
Tuesday, October 11, 2011
Remove extra spaces from file in linux.
If you found spaces and non-ASCII characters with in files, remove all from a file in place.
Solution is:
perl -i.bak -pe 's/[^[:ascii:]]//g' filename
Thanks-
Solution is:
perl -i.bak -pe 's/[^[:ascii:]]//g' filename
Thanks-
Wednesday, September 28, 2011
My New Writeup.
I am not good writer, still i am writing things which is need to me and people who find needful for them.
This is my another Tech Blog. I hope its useful for all of us.
Please visit: http://linux-fundamentals.blogspot.com/
Thanks-
This is my another Tech Blog. I hope its useful for all of us.
Please visit: http://linux-fundamentals.blogspot.com/
Thanks-
Subscribe to:
Posts (Atom)
