#!/usr/bin/python
#coding=utf-8
'''
Created on Nov 4, 2015
install basic system [c2]
@author: Galbraith
'''
from subprocess import call
from os.path import basename
import os
import sys
import commands
def scall(cmd_line):
'''linux shell '''
return call(cmd_line,shell=True)
def findstrinfile(filename, lookup):
'''file str differ check'''
return lookup in open(filename,'rt').read()
def file_check(file_sl):
'''file differ check'''
return os.path.isfile(file_sl)
def dir_check(dir_sl):
'''dir differ check'''
return os.path.exists(dir_sl)
def srun(comm):
'''system command'''
return os.system(comm)
def mount_disk():
'''mount new disk'''
srun('mkdir /data')
srun('mkfs -t ext4 /dev/vdb')
srun('mount /dev/vdb /data')
srun('echo "/dev/vdb /data ext4 defaults 0 0" >> /etc/fstab')
def cat_mount():
mount = commands.getoutput('mount -v')
lines = mount.split('\n')
points = map(lambda line: line.split()[2], lines)
srun('df -h')
print points
def handle():
mount_disk()
cat_mount()
if __name__ == '__main__':
handle()
posted @
2020-07-17 14:33
技术颜良
阅读(
290)
评论()
编辑
收藏
举报