10 March 2015

Helping Hand

# TO FIND OR REMOVE FILES OLDER THEN 30 DAYS

$ find . -mtime +30 | xargs rm

$ find . -type f -mtime +30 -delete

$ find /logs/ -mtime +30 -exec rm {} \;

#TO CHECK PRODUCTS INSTALLED ON A UNIX SERVER

UNIX/LINUX/AIX/HP-UX

$ df -P 2>/dev/null | grep "^/" | grep -v "/proc" | awk '{if ($1!~/:/){print "find " $NF " -xdev -name versionInfo.sh -o -name weblogic.jar -o -name catalina.jar -o -name webservd -o -name httpd -o -name jboss-management.jar -o -name domian.xml -o -name standalone.xml -o -name Agent.jar -o -name LLAWP -o -name server.cnf"}}' | sh | grep -v "^/var/tmp" | grep -v "^/tmp"

SOLARIS

$ df -l | grep "^/" | grep -v "/proc" | nawk -F "(" '{print "find " $1 " -xdev -name versionInfo.sh -o -name weblogic.jar -o -name catalina.jar -o -name webservd -o -name httpd -o -name jboss-management.jar -o -name domian.xml -o -name standalone.xml -o -name Agent.jar -o -name LLAWP -o -name server.cnf"}' | sh | grep -v
"^/var/tmp" | grep -v "^/tmp"

# TO TAKE BACKUP OF WEBLOGIC DOMAIN IN ONE COMMAND

$ find /apps -name "config.xml" | grep "/config/config.xml" | awk '{gsub(/config.xml/,"",$0); fileName=$0; gsub(/\//,"_",fileName);print "mkdir /var/tmp/backup; tar -cvzf /var/tmp/backup/"fileName".tar.gz " $0}' | sh

# TO CHECK THE FILE PERMISSIONS

$ find . \! -perm 750 -exec ls -ldb {} \;

# TO CHECK THE OWNERSHIP

$ cat /etc/passwd grep 533

# TO REPLACE A STRING IN A NESTED FS

$ find . -type f xargs perl -pi -e 's;abc;xyz;g'
$ find . -name '*.xml' -o -name '*.conf' -o -name '*.properties' -o -name '*.sh' | xargs perl -pi -e 's?abc?xyz?g'

# TO GREP A STRING INTO A NESTED FS

$ grep -rnw . -e "2.2.27"

# TO REPLACE A STRING IN A FILE THRU vi

$ %s/string1/,/string2/g

# TO CHECK CERTIFICATE DETAILS IN APACE/WEBLOGIC/IPLANET USING OPENSSL/KEYTOOL/CERTUTIL

$ openssl x509 -in |name.crt|  -noout -text
$ openssl x509 -subject -dates -issuer -noout -in |file|

$ Keytool -list -v -keystore |name.jks|

$ certutil -L -d |name-cert8.db|

#WEBLOGIC PATCHING THRU BSU

$ ./bsu.sh param1 -patch_download_dir param2 option -prod_dir option

$ ./bsu.sh -patch_download_dir=/apps/wlserver/10.3.6/utils/bsu/cache_dir -patchlist=FSR2 -prod_dir=/apps/wlserver/10.3.6/wlserver_10.3/ -verbose –install (to install patch)

$ ./bsu.sh -remove -patchlist=T5F1 -prod_dir=/apps/wlserver/10.3.6/wlserver_10.3/ (to remove patch)

$ ./bsu.sh -view -patch_download_dir=/apps/wlserver/11g/utils/bsu/cache_dir -status=applied -verbose -prod_dir=/apps/wlserver/11g/wlserver_10.3 (to check status of patch)

#TO CREATE USER IN LINUX

$ useradd -u 520 -g beagrp -d /home/user1 -m -s /bin/ksh user1 ;echo "password" | /usr/bin/passwd --stdin user1

#TO CLEAR CACHE OF SERVER

$ sync;sync echo3 >/proc/sys/vm/drop_cache

#TO CHECK LAST LOGIN DETAILS

$ last | grep Mon | awk '{print $1}' | sort -u

Br
Punit

No comments:

Post a comment