Wednesday, October 5, 2016

Troubleshooting of Linux Issues Part - 1

1) SVN

1.  check permission
2.  password less user
3.  user password expiry details
4.  check owner and group
5.  check scripts and script permission , owner & group
6.  check tortoise version
7.  verify subversion version
8.  check repository path and permission, owner permission
9.  telnet subversion 3690
10 ping subversion
11 check repo size ( same time repo size will 40 gb so you get error a time of check out )
12 Performing a simple "svn cleanup" followed by an "svn update" again will solve your problem
13 check password less ssh with both side
14 reset password and try
15 check svn port
16 check user add or not under svn

2) how to check memory utilization of all process 

ps aux  | awk '{print $6/1024 " MB\t\t" $11}'  | sort -n

 ps aux|awk '{print $6/1024 " MB\t\t" $11}'| sort -n|grep redis

 ps aux|awk '{print $6/1024 " MB\t\t" $11}'| sort -n|grep httpd

ps -eo pcpu,pid,user,args | sort -k1 -r | head -10

ps aux | sort -nrk 3,3 | head -n 5

watch "ps aux | sort -nrk 3,3 | head -n 5"

ps -Ao user,uid,comm,pid,pcpu,tty --sort=-pcpu | head -n 6

ps -eo pcpu,pid,user,args --no-headers| sort -t. -nk1,2 -k4,4 -r |head -n 5


The following command will show the list of top processes ordered by RAM and CPU use in descendant form (remove the pipeline and head if you want to see the full list):

ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head
Brief explanation of above options used in above command.

The -o (or –format) option of ps allows you to specify the output format. A favorite of mine is to show the processes’ PIDs (pid), PPIDs (pid), the name of the executable file associated with the process (cmd), and the RAM and CPU utilization (%mem and %cpu, respectively).

Additionally, I use --sort to sort by either %mem or %cpu. By default, the output will be sorted in ascendant form, but personally I prefer to reverse that order by adding a minus sign in front of the sort criteria.

To add other fields to the output, or change the sort criteria, refer to the OUTPUT FORMAT CONTROL section in the man page of ps command.


3) Check URL Logs 

log path :  /usr/local/apache/log

 grep "03/Nov/2016" access-2016-11-03.log | cut -d[ -f2 | cut -d] -f1 | awk -F: '{print $2":00"}' | sort -n | uniq -c

cat access-2016-11-03.log | grep 03/Nov/2016:19 | awk {'print $4,$9'}

check date and time vise log and search as per requirement 
cat access.log | grep 17/Nov/2016 | awk {'print $4,$9'}|grep 200|wc -l


4) Delete multiple files through awk command in linux

ls -lrth|egrep -v "Jul 27"|awk {'print $9'}|xargs rm -rfv
find . -type f -mtime +30 -exec rm -f {} +

5) with out stop running process run under background

used nohup before binery and & in last
example:
nohun clouchDb start &


6) How to check DNS TTL Value
nslookup -type=soa <domain>
nslookup -type=soa savan.com

nslookup -type=A -debug <domain>
nslookup -type=A -debug savan.com


7 ) Data Recovery Open Source Tool!!

http://www.cgsecurity.org/wiki/TestDisk

8) Find command

find / -name tomcat.sh -type f ------------to search file
find -type d -exec chmod 775 {} ; -------- to change file permission
find -type f -exec chmod 664 {} ;

9) Using the locate command

locate -i springframework
locate tomcat.sh

10) hoe to check only sleeping process

ps -e S
ps -eo pid,cmd,etime

11) How-to-resolve-Nagios-Error:Could-not-read-object-configuration-data

yum groupinstall "development tools"

change permissions
chown -R nagios:apache /var/log/nagios
chown -R nagios:apache /var/log/nagios/nagios.log

service nagios restart
service httpd restart

12 ) Set number in text Configuration file (permanent)

To make the setting permanent, add the following line to /etc/vimrc or ~/.vimrc using your favorite text editor
set number

Vim will read the configuration file every time it's started, and will display the line numbers.