-
挂载磁盘脚本
#!/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('
')
points = map(lambda line: line.split()[2], lines)
srun('df -h')
print points
def handle():
mount_disk()
cat_mount()
if __name__ == '__main__':
handle()
-
相关阅读:
引用 struts2标签详解
Java 中日期的计算
在一个FORM中实现多个ACTION动作
java.lang.OutOfMemoryError: PermGen space最好的解决方法
Java实现和栈的应用举例
Java的自动装箱和拆箱
oracle11g更改字符集AL32UTF8为ZHS16GBK
设计的臭味
OOD设计五个原则
推荐JQuery学习简介
-
原文地址:https://www.cnblogs.com/cheyunhua/p/13329827.html
Copyright © 2020-2023
润新知