e2fsck.py
#make sure to run the program from home directry only #>> 1. no directry named 'mount' is present in the working home directry #>> 2. for the user right option , only go if many users are created for the #>> machine #>> for the single user it wont work #>> 3. don't select any option at random . #>> go step wise from 1 to 5 and always after exiting the program remember to #>> delete the mount directry which is created by the program in home #>> directry #>> import os,sys cnt=0 while cnt <5: print "" print "1.Mounting the pendrive" print "2.Checking the disk space availability" print "3.Get the block details of the usb" print "4.Get the status of the file-system of the usb" print "5.Provide all rights to specific user" print "6.Exit" cnt=int(input("Choose your option ?\n")) if cnt == 1: os.system('lsblk') x = raw_input("Enter the name of the drive you want to mount: ") a = ('mkdir mount') temp = ('mount /dev/' + x + ' '+ 'mount') os.system(a) os.system(temp) if cnt == 2: temp1 = ('df /dev/' + x) os.system(temp1) if cnt == 3: temp2 = ('blkid /dev/' + x) os.system(temp2) if cnt == 4: temp3 = ('umount /dev/' + x) temp4 = ('e2fsck -y -v /dev/' + x) os.system(temp3) os.system(temp4) if cnt == 5: y =raw_input("Enter the name of the user to grant all the file system rights : ") b = ('chown ' + y + ' /dev/' + x) os.system(b)
Tags:
PROGRAMMING