Wednesday, March 19, 2014

puppet

writing custom facts in puppet.

mcollective

Resource Abstraction Layer.  (#puppet resource)

Puppet describe cron (describe everything about resource group)

noop

tools:

gepatto

start with small single purpose modules..

Configuration Management Maturity Model:

Artisian
Centralized
Normalized
Templated
Reusable   --- hiera

Learn from Developers (Versioning) .. #subversion

Have a lab

##Investment ##

Oracle class




Tuesday, February 18, 2014

Perl Documents:

http://docstore.mik.ua/orelly/perl3/prog/ch10_02.htm

http://www.tutorialspoint.com/perl/perl_modules.htm

Tuesday, July 9, 2013

Booting in Linux Rescue Mode

1) Boot from DVD or other image file

2) Select rescue mode
linux rescue
linux rescue mpath

3) Once the rescue environment finishes booting, choose a language to use.

4) Select keyboard layout to use.

5) Wait for network interfaces to be located, and activate them, so that requested data can be transferred to another host.

6) The rescue environment will try to find the current Red Hat installation on the system. You will be prompted with the below options:
For this you will want to skip having Rescue Mode search for partitions. Make sure to boot into rescue mode to not automatically detect the partitions. 

7) Use the  fdisk -l command to find boot. This will be marked with an * <-- boot="" c0d0p1="" can="" cciss="" div="" either="" for="" is="" know="" mount.="" or="" sda1="" show="" something="" the="" then="" this="" what="" will="" you="">

8)If LVM is used:
Scan for metadata:
# lvm pvscan 
# lvm vgscan
# lvm lvscan

# lvm lvdisplay to find out what lv is root
# lvm vgchange -ay /dev/volgroup   to activate

May want to run fsck on these filsystems  <---- div="" important="">



Then start creating the chroot environment:
1. #mkdir /mnt/sysimage

** # mount /dev/vg00/logvolroot /mnRescuet/sysimage **

2. #mount /dev/sd1 /mnt/sysimage/  <----root div="">
3. #mount /dev/dcciss/c0d0p1 /mnt/sysimage/boot <---- boot="" div="">
4. #mount /dev/cciss/c0d0p2 /mnt/sysimage/opt <---- div="" opt="">

Then you have to mount proc, sys, and dev regardless:
5. # mount -o bind /proc /mnt/sysimage/proc
6. # mount -o bind /sys /mnt/sysimage/sys
7. # mount -o bind /dev /mnt/sysimage/dev
8. # mount -o bind /usr /mnt/sysimage/usr

Then you should be able to chroot in.
9. # chroot /mnt/sysimage

Wednesday, May 29, 2013

Simple procedure to installing cups printer from Linux server:


Searching for the required packages using yum

[root@pavan /]# yum search cups
Loaded plugins: product-id, rhnplugin, security, subscription-manager
Updating certificate-based repositories.
====================================================== N/S Matched: cups ======================================================
gutenprint-cups.x86_64 : CUPS drivers for Canon, Epson, HP and compatible printers
cups.x86_64 : Common Unix Printing System
cups-pk-helper.x86_64 : A helper that makes system-config-printer use PolicyKit
ptouch-driver.x86_64 : CUPS driver for Brother P-touch label printers
  Name and summary matches only, use "search all" for everything.
[root@pavan /]#

Installing the packages..  
 [root@pavan /]# yum install cups.x86_64
Loaded plugins: product-id, rhnplugin, security, subscription-manager
Updating certificate-based repositories.
Setting up Install Process
Resolving Dependencies
Dependency Updated:
  dbus-libs.x86_64 1:1.2.24-7.el6_3
Complete!
Install Hp Supported driver for cups printer.

[root@pavan /]# yum install gutenprint-cups.x86_64
Loaded plugins: product-id, rhnplugin, security, subscription-manager
Updating certificate-based repositories.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gutenprint-cups.x86_64 0:5.2.5-2.el6 will be installed
--> Processing Dependency: gutenprint = 5.2.5-2.el6 for package: gutenprint-cups-5.2.5-2.el6.x86_64
--> Processing Dependency: libgutenprint.so.2()(64bit) for package: gutenprint-cups-5.2.5-2.el6.x86_64
--> Running transaction check
---> Package gutenprint.x86_64 0:5.2.5-2.el6 will be installed
Complete!
[root@pavan /]#

Configuring cups
Just edit /etc/cups/cupsd.conf

Keep the following entries:
# Only listen for connections from the local machine.
Listen 172.50.0.95:631
Listen /var/run/cups/cups.sock

# Restrict access to the server...
  Order allow,deny
  Allow 192.168.0.0/16 10.0.0.0/8 62.243.72.0/24 127.0.0.1  (here add client vpn address)
# Restrict access to the admin pages...
  Order allow,deny
  Allow 192.168.0.0/16 10.0.0.0/8 62.243.72.0/24 127.0.0.1 (here add client vpn address)

open the port 631.
Service cups restart

Go to browser with ip address:
http://172.50.0.95:631/

Add the required printer & enjoy printing. ...

Friday, January 25, 2013

Linux Booting problems


 The Linux box not able to boot due to external file system errors

Loggin to single user mode # all file systems other than vg00

a.) interrupt the normal booting process & enter into grub menu
then choose the kernel version you want to boot select it press enter. choose the second line starting  
with kernel and press e to edit. At the end of the line after one space put 1 (press enter key to save the changes) then b to boot in single user mode

b) After it prompts for logging password enter root password and mount root file system in read write mode

   mount -o rw /                    or munt -o remount,rw /
   cp -p /etc/fstab /etc/fstab_25jan
   /usr/bin/vim /etc/fstab
(# all other file systems other than vg00)

reboot the server.

Linux kernel panic recovering through maintenance mode

Boot the Linux OS through installation media and select recovery .

Script For Searching alerts in Syslog and Dropping a mail


#!/usr/bin/sh
#################################################################################
#       Script Name  : syslog_error_chk.sh                                                                                                     #                                                                                    
#                                                                                                              #                                                              
#       Description  : Searches for errors in syslog and mail .                                                                        #                                                          
#################################################################################

Thursday, January 24, 2013

Unix Interview Questions

How to convert a ext2 file system to ext3 ?

What modprobe will do in Linux ?

what is the use of kudzu ?



@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@

How to print two files columwise in third file ?

paste -d' ' file1 file2 

How to check different error count in a log file ?

Maintain error count record and if the error count is more than previous ignore. if the error count is less than previous reset the counters.  

How to reverse a string or check weather its a palindrome or not ?

string_new = rev string1 #### it gives the reverse of the string.
test string_new = string1; if [$? -eq 0] ;then do echo "its a palindrome";fi

########################################################3

1) Tell me about yourself ?

2) tell me your day to day activities ?

3.) replacing a boot disk ?

4) patching HP-Ux ?

5) Hardware models you worked on ?

6) processor of Hp9000 series ?

7) How do you trouble shoot ?

8) script to cut a particular field ?

9) script to print a file reversely ?

tail -r myfile.txt

or
tac reverse of cat

tac myfile.txt

10) perl scripting exp >. ?

11)  Disk addition ?

12) Disk addition in cluster ?

13) creating a software depot ?

14) checking model /

15) do you have any specific questions ?



***************************************

 Tell me about your work .. ?

Rate yourself in Perl Scripting and Shell scripting ?

How you write modules in puppet ?

About exadata & Data Ontap ?

Perl Scripting:

 -- > Autoloader ?

---> Difference between a module and package ?

Tell me about your environment in puppet ?

How to configure password less ssh ?

Any Other Questions to Ask ?

*************************************
***********************************
Tell me about yourself?

How do you rate on scale of 1-10?

Hp Service Guard?
 How to configure a package?

How do you mirror lv?

How do you restore a failed disk?

what is major number ? minor number ?

Saturday, January 12, 2013

Useful links


Redhat LVM



Linux SAN and devices:


Solaris file system:


Hpux Bad disk:






Hp Ux Troubleshooting:


Sunday, September 9, 2012

Capacity Request for LVM (Hp ux and Redhat)

Types:

Linux Normal::

1. discover new disk by scanning hbas (vendor specific scripts ) or echo "- - -"
2. then use fdisk
3.pvcreate /dev/rdsk/C0t1d23
4.mknod
5.vgcreate
6.lvcreate
   b.) makefs
7.mount

##################for existing lv ##########
vgextend
lvextend
extend2fs  or resize2fs depending on the version which supports

Linux Cluster::

For Cluster follow the same procedure ..

we have to restart cluster service in other node
service cmcld stop/start

Hp-Ux Normal:

1.) take ioscan out put to one file & then do insf -c disk to discover the disk
2.) take ioscan out put and compare to find new disks
3.) pvcreate /dev/rdsk/cxtydz
4.)vgcreate
5.)lvcreate
6.)makefs
7.)mount


##################for existing lv ##########
vgextend
lvextend
fsadm or extendfs depending on the version which supports

Hp-Ux Cluster:

Follow the above steps .  . if extended vg then we have to do vgexport in preview mode and  in other node we to export the vg and we have to import again with new map file.

Node 1: (active)
vgexport -p -v -s -m old.dsk old.map /dev/testvg
scp old.map node2:/

Node 2:
vgexport /dev/testvg
vgimport -m old.map -s /dev/testvg



Hp-Ux BCV / GBCV :

We have to mask the corresponding BCV / GBCV luns

Common Problems::

1.) File system is 100% utilized..
 a) then we have to extend small amount
 b) Free up some space to write
2.) Number of free PE s completed
3.) Need to defragment the file system


Wednesday, April 4, 2012

grep -r in Hp-Ux // Recursive grep in Hp-Ux


We can use the below script to search recursively in hp-ux. We can added this to path. so that we can run it directly any time.

#!/usr/bin/sh
typeset DIR=$1
typeset PAT=$2
find ${DIR} -xdev -type f | while read FILE
do
[ `file ${FILE} | grep -c ascii` -eq 0 ] && continue
grep "$PAT" ${FILE} /dev/null
done
exit 0


Tuesday, December 20, 2011

Send large files to email from linux box

uuencode:

we can send large files to email from linux box using this command.

Syntax:

uuencode file-name file-name|sendmail -v mailid@mail.com

          or
uuencode file-name file-name|mailx -s "some-file" mailid@mail.com

Monday, June 13, 2011

UNIX95


################################################################################

UNIX95

UNIX95= ps -eo pid,user,sz,vsz,args|sort -nbk3|tail -20  (it will sort according to third field i.e sz)

UNIX95= ps -ef -o pid,ruser,vsz,args|sort -nrk3
UNIX95= ps -eo pid,user,sz,vsz,pcpu,args|sort -nbk5 | tail -10  (for cpu)
UNIX95= ps -eo pid,user,sz,vsz,args|sort -nbk3|tail -20
UNIX95= ps -eo pid,user,sz,vsz,args|sort -nbk3|grep -i 'LOCAL=NO'|wc -l

 #################################################################

GBL_MI_LOST_PROC is greater than zero.



#view /var/opt/perf/status.scope
GBL_MI_LOST_PROC is greater than zero:
**** 06/11/11 00:35:00 ****
Server collector startup completed, beginning data collection.
Collection intervals: Process = 60   Global = 300
Warning: GBL_MI_LOST_PROC is greater than zero.
**** /opt/perf/bin/scopeux : 06/11/11 23:30:00 ****
Start of /var/opt/perf/datafiles/logproc file roll
**** /opt/perf/bin/scopeux : 06/11/11 23:30:24 ****
Successfully rolled /var/opt/perf/datafiles/logproc.
@@@@@@@@@@@
ref:
GBL_MI_LOST_PROC:-
The number of processes the measurement layer has lost the ability to update during the interval. This is an indication the
system activity might require the midaemon be restarted with a larger process count. See the midaemon man page for additional
information on the -pids parameter.
man midaemon
18:root [/var/opt/perf] file status.mi
status.mi:      ascii text
18:root [/var/opt/perf] cat status.mi|tail -30

Friday, June 10, 2011

BCV(Business Continuity Volume)


EMC for DBA's

Symmetrix refers to the EMC disk devices, disks within thid symmetix can be divided into various sized logical volumes, these logical volumes can be logicaly joined together and presented to a server.

There are 2 types of logical volume:

Hypervolumes - range of continuos space on a single disk. A single disk can be divided into 128 parts or hypervolumes this is refered to as slicing or splitting. These now form the basis to create metavolumes.

Metavolumes - A group of hypervolumes of the same size grouped together, this is then presented to a server. Once part of a metavolume, only the whole meta can be presented to the server not single disks.

Meta Head and Tail
When hypervolumes are added to a metavolume they are given a sequence, the first hyper being the head and last being the tail. Data is written to Meta from head to tail.


Priner issues .. trouble shooting



#cd /etc/lp/interface  

#ll|grep -i printname
#lpstat -vprintname  (printer details)
#lpstat -oprintname (printer queue status)
#lpstat -pprintname (printer status)

#w
#cd

#telnet ip portno
#echo "TEST PRINT"|lp -d printname (sending a test print)
#echo "TEST PRINT"|lp -d printname
#lpstat -ojprintname (cheking weather it got fired from the queue)

LP printer Creation:

lpadmin -p -orm -orp -mrmodel -v/dev/null -orc -ocmrcmodel -osmrsmodel

lpadmin -p143_zb1 -ormAUABGN-PRN2 -orp143_zb1 -mrmodel -v/dev/null -orc -ocmrcmodel -osmrsmodel

Monday, April 25, 2011

Some useful commands.



lsof is a command meaning "list open files", which is used in many Unix-like
systems to report a list of all open files and the processes that opened them

Dmidecode reports information about your system's hardware as described in your
system BIOS according to the SMBIOS/DMI standard.(Linux)

Memory & Cpu utilization : 
Top (linux)
Glance(unix)
UNIX95=
swapinfo -tm
cat /proc/meminfo
free -tml (t-total,m-megabites,l-diff b/w low high)

File system utilization: 
du -sk * (individually)
du -sk .(collectively)

Timex :  we know time taken by different users to run a command.


Unix Nohup: Run a Command or Shell-Script Even after You Logout

When you execute a Unix job in the background ( using &, bg command), and logout from the session, your process will get killed. You can avoid this using several methods — executing the job with nohup, or making it as batch job using at, batch or cron command.

This quick tip is for beginners. If you’ve been using nohup for a while, leave us a comment and tell us under what situations you use nohup.
In this quick tip, let us review how to make your process running even after you logout, using nohup.
Nohup stands for no hang up, which can be executed as shown below.
nohup syntax:
# nohup command-with-options &
Nohup is very helpful when you have to execute a shell-script or command that take a long time to finish. In that case, you don’t want to be connected to the shell and waiting for the command to complete. Instead, execute it with nohup, exit the shell and continue with your other work.

Explanation about nohup.out file

By default, the standard output will be redirected to nohup.out file in the current directory. And the standard error will be redirected to stdout, thus it will also go to nohup.out. So, your nohup.out will contain both standard output and error messages from the script that you’ve executed using nohup command.
Instead of using nohup.out, you can also redirect the output to a file using the normal shell redirections.

Example: Printing lines to both standard output & standard error

while(true)
do
echo "standard output"
echo "standard error" 1>&2
sleep 1;
done

Execute the script without redirection

$ nohup sh custom-script.sh &
[1] 12034
$ nohup: ignoring input and appending output to `nohup.out'

$ tail -f nohup.out
standard output
standard error
standard output
standard error
..

Execute the script with redirection

$ nohup sh custom-script.sh > custom-out.log &
[1] 11069
$ nohup: ignoring input and redirecting stderr to stdout

$ tail -f custom-out.log
standard output
standard error
standard output
standard error
..
If you log-out of the shell and login again, you’ll still see the custom-script.sh running in the background.
$ ps aux | grep sathiya
sathiya  12034  0.0  0.1   4912  1080 pts/2    S    14:10   0:00 sh custom

nice - run a program with modified scheduling priority  
Run COMMAND with an adjusted scheduling priority. With no COMMAND, print the current scheduling priority. ADJUST is 10 by default. Range goes from -20 (highest priority) to 19 (lowest).
-n--adjustment=ADJUST
increment priority by ADJUST first 

 
 
vgreduce -t ( This will run vgreduce in test mode)

buffer I/O error main reason is difference in I/O timings with storage lun.

[root@d scsi_device]# cat /sys/block/sdab/device/timeout
30
[root@d scsi_device]# 



Aix commands to check kernel parameters

lsattr -E -l sys0
topas
startsrc -s sshd

Sed command to extract data b/w two words in a file

sed -n '/langham/,/langport/p' linux_workout

Mount error

mount: special device  does not exist

(re activate the vg ) or check vg activation status

Thursday, January 21, 2010

mounting linux drives on windows

Ext2 IFS is used to mount linux drives on windows.

you can download the software from...

http://www.fs-driver.org/