Archive for February, 2010

Linux SVN/Subversion Usefull commands

Thursday, February 25th, 2010

Ref:http://svnbook.red-bean.com/en/1.5/svn.tour.cycle.html#svn.tour.cycle.update

(A) How to install and Import directory into repository:
Click here

(B)How to get working copy from svn repository into local machine?
Goto Your home directory , example : cd /root
Now execute bellow commands

[root@mail ~]# svn checkout file:///svn
A    svn/script
A    svn/script/checkmemory.sh
A    svn/config
A    svn/config/httpd-vhosts
Checked out revision 2.

Now you will see there is a directory call svn has been created in to your home directory and this svn has all the files we added before
Example :

[root@mail ~]# ls
 rpmforge-release-0.3.6-1.el5.rf.i386.rpm
epel-release-5-3.noarch.rpm  script
svn
[root@mail ~]# cd svn
[root@mail svn]# ls
config  script
[root@mail svn]# cd script/
[root@mail script]# ls
checkmemory.sh
[root@mail script]# pwd
/root/svn/script
[root@mail script]#

NOte : If you want to just check out only one directory example script. then command would be :

[root@mail ~]# svn checkout file:///svn/script
A    script/checkmory.sh
Checked out revision 2.

(C) How to get the Updated copy of the working directory

[root@mail script]# svn update
U    checkmemory.sh
Updated to revision 3.
[root@mail script]#

While you are working on a file.if any one changes to that file and you want to download those changes, then svn update will give the up to date file.

(D) How to add directory or file to the repository

[root@mail script]# svn add check_cpu.sh check_memory.sh
A         check_cpu.sh
A         check_memory.sh
[root@mail script]#
 
Note : Dont forget to run bellow command to make the update permanently
svn commit

(E) How to delete file or directory

 [root@mail script]# svn delete check_memory.sh 
D         check_memory.sh

(F) How to view overall changes of local modifications

[root@mail script]# svn status
A       check_ping
M       check_cpu.sh
[root@mail script]#

(G) How to view the details of local modifications

For Every modifications( every files)
[root@mail script]# svn diff
Index: check_ping
===================================================================
--- check_ping  (revision 0)
+++ check_ping  (revision 0)
@@ -0,0 +1 @@
+This is a test insert
Index: check_cpu.sh
===================================================================
--- check_cpu.sh        (revision 4)
+++ check_cpu.sh        (working copy)
@@ -0,0 +1 @@
+This is a test line
[root@mail script]#
 
For a particular file:
 
[root@mail script]# svn diff check_cpu.sh
Index: check_cpu.sh
===================================================================
--- check_cpu.sh        (revision 4)
+++ check_cpu.sh        (working copy)
@@ -0,0 +1 @@
+This is a test line
[root@mail script]#

(H) How to commit changes ( update your working copy with svn repository)

   svn commit

Before committing , it will open vim editor and you need to insert some comments about what you updating for your/Other peoples references.

(I) How to check history ?
Ref :http://svnbook.red-bean.com/en/1.5/svn.tour.history.html

[root@mail script]# svn log
------------------------------------------------------------------------
r5 | root | 2010-02-25 14:10:45 +0000 (Thu, 25 Feb 2010) | 3 lines
 
Added Check_ping file
Modified check_cpu file
 
------------------------------------------------------------------------
r4 | root | 2010-02-25 13:55:01 +0000 (Thu, 25 Feb 2010) | 2 lines
 
Added Check_cpu and Delete check_memory.sh file
 
------------------------------------------------------------------------
r3 | root | 2010-02-25 13:42:52 +0000 (Thu, 25 Feb 2010) | 2 lines
 
Just update
 
------------------------------------------------------------------------
r1 | root | 2010-02-25 11:19:54 +0000 (Thu, 25 Feb 2010) | 2 lines
 
Just Adding a directory
 
------------------------------------------------------------------------

Meaning of A,C,D,M:

A item
 
    The file, directory, or symbolic link item has been scheduled for addition into the repository.
C item
 
    The file item is in a state of conflict. That is, changes received from the server during an update overlap with local changes that you have in your working copy (and weren't resolved during the update). You must resolve this conflict before committing your changes to the repository.
D item
 
    The file, directory, or symbolic link item has been scheduled for deletion from the repository.
M item
 
    The contents of the file item have been modified.

How to install Subversion

Thursday, February 25th, 2010

Ref:http://svnbook.red-bean.com/en/1.5/index.html

(A) To install Subversion : yum install mod_dav_svn subversion
(B) How to create a Repo :

svnadmin create /svn

So it will create a svn directory under / directory

[root@mail /]# pwd
/
[root@mail /]# ls
aquota.group  boot      dev   lib    opt   sbin     svn  usr
aquota.user   conffile  etc   media  proc  selinux  sys  var
bin           data      home  mnt    root  srv      tmp
[root@mail /]#

(C) How to import Directory in svn repos ?

 svn import directory/ file:///svn/directory

output :

[root@mail /]# svn import /root/script/ file:///svn/script
Adding         /root/script/checkmory.sh
 
Committed revision 1.

Note After typing the svn import command it will open a Vim editor ,and will ask you to write some comments about this import
Example: I would of write: I am adding the /root/script directory into svn repository.
Pic:

Svn Asking to input comments before adding directory to repository

Svn Asking to input comments before adding directory to repository

Note : if you see bellow error :

svn: Could not use external editor to fetch log message; consider setting the $SVN_EDITOR environment variable or using the --message (-m) or --file (-F) options
svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no 'editor-cmd' run-time configuration option was found

which means: you need to add “vim ” program path into bash_profile files

How to add vim programm path in .bash_profile file :

vi /root/.bash_profile
add this line :
export SVN_EDITOR="/bin/vi"

Now save the file and logoff and log on agian

(d) How to check list of projects in svn repo

[root@mail /]# svn list file:///svn

Output :

script/

Which means script directory has been added into svn repository.
Now if you want to see what is inside script directory

[root@mail /]# svn list file:///svn/script
checkmemory.sh

nagios script for checking mysql server replication status between 4 servers

Monday, February 22nd, 2010

Ref : http://onlamp.com/pub/a/onlamp/2006/04/20/advanced-mysql-replication.html?page=2

Date:22/02/2010
This Script is still under development.

Purpose:

Develop a nagios script, which would be able to check replication status between 4 Master/Master Server.

This scripy will check following :

#1.Each Mysql servers are online : Stats: Done
#2.If Slave process is running : Status:Done
#3.If Slave IO process is running : Status:Done
#4.If There is any bin log position difference between Master/Slave :Status:Done
#5.Check time in processlist for(Has read all relay log; waiting for the slave I/O thread to update it) for further repliation related problems. Status: Under Development
#6.If problem found,change Master server info in Slave, and connect to differerent Master server. :Status :Under Development
#7. Change Dns record(A record) to stop comming http request to the problematic server:Status:Under Development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
 
 
#!/bin/bash
################################################################################
#SVN Version: 28
#Script Version 28
#Purpose of this script:
#Check Bellow options between 4 mysql Master/Master Replication
#1.Every Mysql servers are online: Status:Done
#2.If Slave process is running:    Status:Done
#3.If Slave IO process is running: Status:Done
#4.If There is any bin log position difference between Master/Slave: Status:Done
#5.Check time in processlist for:Status: In Development
#6.If problem found change  Master server info in Slave
#7. Change Dns record(A record) to stop comming http request to the problematic sever
#################################################################################
 
#Status check for nagios script
 
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4
 
 
#Define All the variables
 
declare -rx SCRIPT=${0##*/}
declare -rx CMD_AWK="/bin/awk"
declare -rx CMD_MYSQL="/usr/local/mysql/bin/mysql"
declare -rx CMD_GREP="/bin/grep"
 
##Define value for nagios is to fire for certain conditions for log check
 
CRITICAL_VALUE=100
CRITICAL_VALUE=50
NORMAL_VALUE=0
 
#######################################################################
#####Define All the servers Ip, username and password for mysql server#
#######################################################################
declare -rx SLV_MSTRServerA="Ip.of.your.server"
declare -rx SLV_MSTRServerA_USER="noslave"
declare -rx SLV_MSTRServerA_PASSWD="password"
 
#Slave/Master ServerB (NodeB-web.yourdomian.co.uk)
 
declare -rx SLV_MSTRServerB="ip.of.your.server"
declare -rx SLV_MSTRServerB_USER="noslave"
declare -rx SLV_MSTRServerB_PASSWD="password"
 
#Slave/Master ServerC (NodeC-http.yourdomain.local)
 
declare -rx SLV_MSTRServerC="localhost"
declare -rx SLV_MSTRServerC_USER="noslave"
declare -rx SLV_MSTRServerC_PASSWD="password"
 
 
#Slave/Master ServerD (NodeD-beaver.yourdomain.local)
 
declare -rx SLV_MSTRServerD="ip.of.your.server"
declare -rx SLV_MSTRServerD_USER="noslave"
declare -rx SLV_MSTRServerD_PASSWD="password"
 
#Global Variables
declare -a result
 
 
#Definning Variable for Array
 
declare -a SLV_MSTRServerS=($SLV_MSTRServerA $SLV_MSTRServerB $SLV_MSTRServerC $SLV_MSTRServerD)
declare -a SLV_MSTRServerS_USERS=($SLV_MSTRServerA_USER $SLV_MSTRServerB_USER $SLV_MSTRServerC_USER $SLV_MSTRServerD_USER)
declare -a SLV_MSTRServerS_PASSWD=($SLV_MSTRServerA_PASSWD $SLV_MSTRServerB_PASSWD $SLV_MSTRServerC_PASSWD $SLV_MSTRServerD_PASSWD )
declare -a SLV_ServerAppLS=("SLV_MAIL" "SLV_WEB" "SLV_HTTP" "SLV_BEVR")
declare -a MSTR_ServerAppLS=("MSTR_MAIL" "MSTR_WEB" "MSTR_HTTP" "MSTR_BEVR")
 
 
###########################################################
#Section-1.0:function-Command: My Mysql Servers are online#
###########################################################
 
function FUNC_CHECK_SERVER_ONLINE_CMD
{
 
$CMD_MYSQL -h "$1"  -u"$2" -p"$3" -e "show slave status\G" >/dev/null 2>&1
 
return $?
 
}
 
 
###########################################################
#Section-2.0: Function-Command:If Slave_IO_Running#########
###########################################################
 
function FUNC_CHK_SLV_IO_RUN_CMD
{
 
echo $($CMD_MYSQL -h "$1"  -u"$2" -p"$3" -e "show slave status\G" | $CMD_GREP Slave_IO_Running | awk '{ print $2 }' )
 
}
 
 
##########################################################
#Section-3.0: Function-Command:If Slave_SQL_running#######
##########################################################
 
function FUNC_CHK_SLV_SQL_RUN_CMD
{
 
echo $($CMD_MYSQL -h "$1"  -u"$2" -p"$3" -e "show slave status\G" | $CMD_GREP Slave_SQL_Running | awk '{ print $2 }' )
 
}
 
##########################################################
#Section-4.0: Function-Command:#######
##########################################################
 
function FUNC_CHK_SLV_LOG_POS_CMD
{
 
echo $($CMD_MYSQL -h "$1"  -u"$2" -p"$3" -e "show slave status\G" | $CMD_GREP Read_Master_Log_Pos | awk '{ print $2}' )
 
 
}
 
 
 
##########################################################
#Section-5.0: Function-Command:#######
##########################################################
 
function FUNC_CHK_MSTR_LOG_POS_CMD
{
 
echo $($CMD_MYSQL -h "$1"  -u"$2" -p"$3" -e "show master status" | $CMD_GREP bin | cut -f2 )
 
 
}
 
 
###########################################################
#Section-1.1: If all Mysql Server is Online################
##Implementing Secton 1.0(ref:FUNC_CHECK_SERVER_ONLINE_CMD#
###########################################################
 
function FUNC_CHECK_SERVER_ONLINE()
{
i=0
COUNT=${#SLV_MSTRServerS[*]}
while [ $i -lt $COUNT ]
do
 
if ! $(FUNC_CHECK_SERVER_ONLINE_CMD "${SLV_MSTRServerS[$i]}" "${SLV_MSTRServerS_USERS[$i]}" "${SLV_MSTRServerS_PASSWD[$i]}"  )
 
then
echo " Server IP: ${SLV_MSTRServerS[$i]},is not running "
exit $STATE_CRITICAL
exit 99
fi
 
 
i=$(($i+1))
 
done
 
#echo "All Server are Online"
#exit $STATE_OK
 
}
 
 
###########################################################
#Section-2.1: If Slave_IO_Running IS RUNNING OR NOT########
##Implementing Secton 2.0(ref:FUNC_CHK_SLV_IO_RUN_CMD######
###########################################################
 
 
 
function FUNC_CHK_SLV_IO_RUN()
{
 
i=0
COUNT=${#SLV_MSTRServerS[*]}
while [ $i -lt $COUNT ]
do
result[$i]=$(FUNC_CHK_SLV_IO_RUN_CMD "${SLV_MSTRServerS[$i]}" "${SLV_MSTRServerS_USERS[$i]}" "${SLV_MSTRServerS_PASSWD[$i]}" )
i=$(($i+1))
done
 
 
i=0
while [ $i -lt $COUNT ]
do
if [ ${result[$i]} != "Yes" ]
then
echo "In Server IP: ${SLV_MSTRServerS[$i]},Slave_IO_running is not running "
exit $STATE_CRITICAL
 
fi
i=$(($i + 1 ))
done
#echo "ALL Servers are running fine"
#exit $STATE_OK
 
}
 
###########################################################
#Section-3.1: IF Slave_SQL_Running OR NOT#################
##Implementing Secton 3.0(ref:FUNC_CHK_SLV_SQL_RUN_CMD#####
###########################################################
 
function FUNC_CHK_SLV_SQL_RUN()
 
{
i=0
COUNT=${#SLV_MSTRServerS[*]}
while [ $i -lt $COUNT ]
 
do
result[$i]=$(FUNC_CHK_SLV_SQL_RUN_CMD "${SLV_MSTRServerS[$i]}" "${SLV_MSTRServerS_USERS[$i]}" "${SLV_MSTRServerS_PASSWD[$i]}" )
i=$(($i+1))
done
 
 
i=0
while [ $i -lt $COUNT ]
do
if [ ${result[$i]} != "Yes" ]
then
echo "In Server IP: ${SLV_MSTRServerS[$i]},Slave_SQL_Running is not running "
exit $STATE_CRITICAL
 
fi
i=$(($i + 1 ))
done
 
 
}
 
###########################################################
#Section-4.1: GETTING MASTER LOG POSITION FROM EACH SLAVE##
##Implementing Secton 4.0(ref:FUNC_CHK_SLV_LOG_POS_CMD#####
###########################################################
 
 
function FUNC_CHK_SLV_LOG_POS ()
 
{
i=0
COUNT=${#SLV_MSTRServerS[*]}
while [ $i -lt $COUNT ]
 
do
result[$i]=$(FUNC_CHK_SLV_LOG_POS_CMD "${SLV_MSTRServerS[$i]}" "${SLV_MSTRServerS_USERS[$i]}" "${SLV_MSTRServerS_PASSWD[$i]}" )
i=$(($i+1))
done
 
i=0
while [ $i -lt $COUNT ]
do
eval ${SLV_ServerAppLS[$i]}=${result[$i]}
 
 
i=$(($i + 1 ))
done
 
 
}
 
###########################################################
#Section-5.1: GETTING MASTER LOG POSITION FROM EACH MASTER#
##Implementing Secton 5.0(ref:FUNC_CHK_MSTR_LOG_POS_CMD#####
###########################################################
 
 
 
function FUNC_CHK_MSTR_LOG_POS ()
 
{
i=0
COUNT=${#SLV_MSTRServerS[*]}
while [ $i -lt $COUNT ]
 
do
result[$i]=$(FUNC_CHK_MSTR_LOG_POS_CMD "${SLV_MSTRServerS[$i]}" "${SLV_MSTRServerS_USERS[$i]}" "${SLV_MSTRServerS_PASSWD[$i]}" )
i=$(($i+1))
done
 
 
i=0
while [ $i -lt $COUNT ]
do
eval ${MSTR_ServerAppLS[$i]}=${result[$i]}
 
 
i=$(($i + 1 ))
done
 
 
}
 
#########################################################################################
 
#Section-4.1/5.1: FIND OUT LOG POSITION DIFFERENCE#######################################
##Implementing Secton 4.1 and 5.1(ref:FUNC_CHK_SLV_LOG_POS) AND   FUNC_CHK_MSTR_LOG_POS##
#########################################################################################
 
 
function FUNC_FIND_LOG_POS_DIFF ()
 
{
################################################################
##Calling FUNC_CHK_SRV_LOG_POS and FUNC_CHK_MSTR_LOG_POS########
## To Get All the output from Servers###########################
################################################################
 
FUNC_CHK_SLV_LOG_POS
FUNC_CHK_MSTR_LOG_POS
 
echo "Master log position from each master(show master status)"
echo "mail: $MSTR_MAIL"
echo "web: $MSTR_WEB"
echo "http: $MSTR_HTTP"
echo " beaver: $MSTR_BEVR"
 
 
 
echo "MAster log position from each  Slave(show slave status) "
echo "mail: $SLV_MAIL"
echo "web: $SLV_WEB"
echo "http: $SLV_HTTP"
echo "beaver: $SLV_BEVR"
 
 
 
 
### note : $SLV_MAIL will be equal to $MSTR_BEVR
### Note : $SLV_WEB will be equal to $MSTR_MAIL
### Note : $SLV_HTTP will be equal to $MSTR_WEB
### Note : $SLV_BEVR will be equal to $MSTR_HTTP
 
if [ $SLV_MAIL -ne $MSTR_BEVR ]
 
then
echo "Problem between Server Mail: $SLV_MAIL and Server BEVR:$MSTR_BEVR"
exit $STATE_CRITICAL
fi
 
if [ $SLV_WEB -ne $MSTR_MAIL ]
 
then
 
echo "Problem between Server WEB:$SLV_WEB and Server MAIL:$MSTR_MAIL"
exit $STATE_CRITICAL
fi
 
if [ $SLV_HTTP -ne $MSTR_WEB ]
 
then
echo "Problem between Server HTTP:$SLV_HTTP  and Server WEB:$MSTR_WEB "
exit $STATE_CRITICAL
fi
 
if [ $SLV_BEVR -ne $MSTR_HTTP ]
 
then
echo "Problem between Server BEVR:$SLV_BEVR and Server HTTP:$MSTR_HTTP"
exit $STATE_CRITICAL
fi
 
 
}
 
 
######################################################################
#Calling all function from  section [1.1,2.1,3.1,4.1,5.1]#############
######################################################################
 
FUNC_CHECK_SERVER_ONLINE
FUNC_CHK_SLV_IO_RUN
FUNC_CHK_SLV_SQL_RUN
FUNC_FIND_LOG_POS_DIFF
 
 
#####################################################################
## If there is not any error from section[1.1,2.1,3.1,4.1,5.1]#######
## then show bellow commands to ensure nagios all OK ################
#####################################################################
 
 
 
#echo $SLV_HTTP
#echo $SLV_BEVR
 
#echo $MSTR_MAIL
#echo $MSTR_WEB
#echo $MSTR_HTTP
#echo $MSTR_BEVR
 
echo "ALL Servers are running fine"
exit $STATE_OK

Linux:If Running Kernel Is 32 Or 64 Bit

Thursday, February 18th, 2010

To find out, if Your kernel is 64 bit or 32 bit, run this commands

uname -a

Sample Out put for 64 bit kernel :

Linux  2.6.16.53-070731a #1 SMP Tue Jul 31 10:46:54 CEST 2007 x86_64 x86_64 x86_64 GNU/Linux

here x86_64 GNU/Linux indicates this kernel is 64 bit.

Sample Output for 32 bit kernel :

Linux sandbox.hostname.local 2.6.18-164.11.1.el5 #1 SMP Wed Jan 20 07:39:04 EST 2010 i686 i686 i386 GNU/Linux

here i386 GNU/Linux indicates its a 32 bit kernel, also if you see i386/i486/i586/i686 which indicates its 32 bit kernel

also:
How to find if processor is 32 bit or 64 bit:
ref : http://fosiul.com/index.php/2010/02/linux-how-to-conferm-64bit32bit-capability-of-cpu/

Additional repository list for 32 bit kernel and 64 bit kernel
http://fosiul.com/index.php/2009/12/yum-repo-list-for-centos/

Linux-How to conferm 64bit/32bit capability of CPU

Wednesday, February 17th, 2010

How many CPU in the system :

commands : cat /proc/cpuinfo

 
[root@server ~]# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Xeon(TM) CPU 3.40GHz
stepping        : 3
cpu MHz         : 3401.008
cache size      : 2048 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl est cid xtpr
bogomips        : 6805.07
 
processor       : 1
vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Xeon(TM) CPU 3.40GHz
stepping        : 3
cpu MHz         : 3401.008
cache size      : 2048 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl est cid xtpr
bogomips        : 6799.15
 
processor       : 2
vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Xeon(TM) CPU 3.40GHz
stepping        : 3
cpu MHz         : 3401.008
cache size      : 2048 KB
physical id     : 3
siblings        : 2
core id         : 3
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl est cid xtpr
bogomips        : 6799.30
 
processor       : 3
vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Xeon(TM) CPU 3.40GHz
stepping        : 3
cpu MHz         : 3401.008
cache size      : 2048 KB
physical id     : 3
siblings        : 2
core id         : 3
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl est cid xtpr
bogomips        : 6799.40
 
[root@server ~]#

From the example above there is 4 processor in the system [ processor 0 …. processor 3]

also :

short cut : cat /proc/cpuinfo  | grep processor
processor       : 0
processor       : 1
processor       : 2
processor       : 3


How to find out if processors are 64bit or 32 bit

From the out put cat /proc/cpuinfo, look at the flags column, if there is a word call lm , that means its
a 64bit processor.

Short cut commands :
grep flags /proc/cpuinfo

output :

[root@server ~]# grep flags /proc/cpuinfo
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl est cid xtpr
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl est cid xtpr
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl est cid xtpr
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl est cid xtpr

From the output above, all four processors has lm word, which means its 64 bit processors
if you do not see lm word, then its 32 bit processor.

Linux/windows-How to add a printer from cups by using .ppd file

Friday, February 12th, 2010

Recently I was trying to add a Canon LBP3460 Printer in my linux Server, I was trying to use .ppd which was available from canon website, but that file would not work.

so I download the file from : http://openprinting.org/printer_list.cgi , and its works perfectly .

here is the procedure::

Download the .ppd file from http://openprinting.org/printer_list.cgi

Upload the file into /usr/share/cups/model/ Directory.

Note : here I added the printer in windows 2003 server and made this printer Shareable by using port number 9100

example : port name : NPI414B70 and port number 9100

as described in the bellow picture

adding printer in windows 2003 server

adding printer in windows 2003 server

Now open your Cups interface by : https://localhost:631

Goto Administration->add new printer and follow as bellow pictues

Adding a new printer in cups (step1)

Adding a new printer in cups (step1)(Click to view Full image)

Selecting how this printer will be connected to linux

Selecting how this printer will be connected to linux

Definning the url for connecting to this printer

Definning the url for connecting to this printer(step3)(Click to view Full image)

cups5

Selecting model/driver for the printer(Step5) (Click to view Full image)

Selecting model(Step4)(Click to view Full image)

Selecting model(Step4)(Click to view Full image)

now you should be able to print from that printer.

How to install puppet in server and client

Monday, February 8th, 2010

Ref : http://docs.reductivelabs.com/guides/installation.html#open_firewall_ports_on_server_and_client

How to install puppet Client:

If yum can not find puppet software you can add bellow repo :

http://fosiul.com/index.php/2009/12/yum-repo-list-for-centos/

after adding repos

(a) yum install puppet( to install puppet client rpm)

(b) edit /etc/puppet/puppetd.conf and add references of puppet server

server = puppet-server.companydomain.com

Or Execute bellow command to connect to puppet server:
puppet agent –server fosiul.fosiul.lan –waitforcert 60 –test

(c) /usr/sbin/puppetd –verbose ( Start the client for the first time)

it will show below output

[root@pupet-client]# /usr/sbin/puppetd –verbose
warning: peer certificate won’t be verified in this SSL session
notice: Did not receive certificate

(d) Now go to Puppet Server , and type

[root@puppet-server]# puppetca –list
puppet-client.companydomain.com

(e) Now Again in the server execute bellow command, this command will sign the certificate fro the pupppet-client host.

puppetca –sign puppet-client.companydomain.com

Note :

(a) Make sure port 8140 (tcp/udp) open in puppet-server

and you have allow only puppet-client’s ip to connect puppet-server

Example :

-A RH-Firewall-1-INPUT -p tcp -m tcp -s ip-of-puppet-client –dport 8140 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp -s ip-of-puppet-client –dport 8140 -j ACCEPT