About Me

My photo
HI , this is Shivakant working in IT Infrastructure from about 20 years now .Implemented many small and large data centers , Executed huge Storage Migration , Implemented Backup Infrastructure for many small and Big organizations.I am a passionate learner of new technology , Love to fiddle with gadgets and read about them on internet. love to read books .

Thursday, August 23, 2018

AUTOMATE MANAGEMENT OF FILE SYSTEM SPACE IN AIX

ALL DOCUMENT ARE PROPERTY OF SHIVAKANT , DO NOT COPY IBM , AIX , HACMP , ARE REGISTERED TRADE MARK OF IBM, NETAPP IS REGISTERED TRADEMARK OF NETAPP
http://aix-administration.blogspot.com/p/index-of-posts-available-in-this-blog.html


HI most of you guys "just" work on regularly on file systems space management , for example /var 

i have created a script that may be very helpful to you for this mundane work 

THE SCRIPT BELOW CHECKS FOR ANY FILES GREATER THAN 50 MB AND COPIES IT ADDING CURRENT DATE IN THE NAME  , ZIPS IT , AND CLEARS IT

for x in $(find /var -xdev -size +$(( 2048 * 50 )) -exec du -am {} \;|awk '{print $2}')
do
d=$(date +"%d%m%y")
cp $x $x$d
gzip -9 $x$d
>$x
done


YOU CAN ALSO USE read WITH THE SCRIPT 

 echo enter the file system to check 
read a
for x in $(find $a -xdev -size +$(( 2048 * 20 )) -exec du -am {} \;|awk '{print $2}')
do
d=$(date +"%d%m%y")
cp $x $x$d
gzip -9 $x$d
>$x
done



 





Wednesday, July 25, 2018

CONNECTING AND TESTING MONGODB USING PYTHON

ALL DOCUMENT ARE PROPERTY OF SHIVAKANT , DO NOT COPY IBM , AIX , HACMP , ARE REGISTERED TRADE MARK OF IBM, NETAPP IS REGISTERED TRADEMARK OF NETAPP
 http://aix-administration.blogspot.com/p/index-of-posts-available-in-this-blog.html


CONNECTING AND TESTING MONGODB USING PYTHON

[root@localhost ~]# python
Python 2.7.5 (default, Jul 13 2018, 13:06:57)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymongo
>>> from pymongo import MongoClient
>>> client = MongoClient()
>>> db = client.mydb
>>> collection = db.staff


VIEWING DATABASE DETAILS FROM MONGODB IN PYTHON
>>> ret = collection.find()
>>> for record in ret:
...     print(record)
...
{u'salary': 40000, u'name': u'akash', u'age': 20, u'experience': 10, u'sex': u'male', u'location': u'delhi', u'skill': u'storage', u'_id': ObjectId('5b4b5db7e90739b5b94ceff7')}
{u'salary': 50000, u'name': u'ananya', u'age': 23, u'experience': 12, u'sex': u'female', u'location': u'delhi', u'skill': u'os', u'_id': ObjectId('5b4b5db7e90739b5b94ceff8')}
{u'salary': 60000, u'name': u'shiva', u'age': 24, u'experience': 10, u'sex': u'male', u'location': u'noida', u'skill': u'backup', u'_id': ObjectId('5b4b5db7e90739b5b94ceff9')}
{u'salary': 60000, u'name': u'rohan', u'age': 30, u'experience': 10, u'sex': u'male', u'location': u'delhi', u'skill': u'storage', u'_id': ObjectId('5b4b5db7e90739b5b94ceffa')}
{u'salary': 12000, u'name': u'reema', u'age': 35, u'experience': 5, u'sex': u'female', u'location': u'bangalore', u'skill': u'os', u'_id': ObjectId('5b4b5db7e90739b5b94ceffb')}
{u'salary': 12000, u'name': u'ramesh', u'age': 37, u'experience': 4, u'sex': u'male', u'location': u'bangalore', u'skill': u'backup', u'_id': ObjectId('5b4b5db7e90739b5b94ceffc')}
{u'salary': 60000, u'name': u'dinesh', u'age': 40, u'experience': 10, u'sex': u'male', u'location': u'hydrabad', u'skill': u'linux', u'_id': ObjectId('5b4b5db7e90739b5b94ceffd')}
{u'salary': 75000, u'name': u'juhi', u'age': 28, u'experience': 15, u'sex': u'female', u'location': u'hydrabad', u'skill': u'linux', u'_id': ObjectId('5b4b5db7e90739b5b94ceffe')}
{u'salary': 120000, u'name': u'mahesh', u'age': 39, u'experience': 20, u'sex': u'male', u'location': u'bangalore', u'skill': u'aix', u'_id': ObjectId('5b4b5db7e90739b5b94cefff')}
{u'salary': 120000, u'name': u'mayank', u'age': 31, u'experience': 20, u'sex': u'male', u'location': u'delhi', u'skill': u'aix', u'_id': ObjectId('5b4b5db7e90739b5b94cf000')}
{u'salary': 90000, u'name': u'shshank', u'age': 28, u'experience': 16, u'sex': u'male', u'location': u'noida', u'skill': u'sap', u'_id': ObjectId('5b4b5db7e90739b5b94cf001')}
{u'salary': 80000, u'name': u'rohit', u'age': 38, u'experience': 12, u'sex': u'male', u'location': u'delhi', u'skill': u'sap', u'_id': ObjectId('5b4b5db7e90739b5b94cf002')}
>>> 
 

flipkart3

Total Pageviews