使用python调用playbook和shell脚本
我的python脚本为:
#!/usr/bin/env python
import ansible.playbook
from ansible import callbacks
from ansible import utils
import json
import commands
status, result = commands....
分类:
其他好文 时间:
2015-07-13 20:42:57
阅读次数:
250
1.利用dm-crypt来创建加密文件系统。编写shell脚本
2.编写ansible,playbook文件
3.编写python脚本
首先编写shell脚本
#!/bin/sh
sudo apt-get install dmsetup cryptsetup
sudo modprobe dm-crypt
echo "dd if=/dev/zero of=/home/prod/secr...
分类:
其他好文 时间:
2015-07-10 13:29:46
阅读次数:
139
安德鲁斯系统备份是非常的情况下,可以使用。下面的这个python脚本。它可以用来备份整个data分:所有data分区的文件和文件夹打包data.zip。并产生recovery专用edify脚本update-script.sh。当然,备份system分区了,假设再加上几行代码,就能够备份boot,re...
分类:
移动开发 时间:
2015-07-08 12:37:27
阅读次数:
403
eclipse中python脚本用默认的字体和大小,注释是中文的也看不清楚,改一下字体吧windows-preferences-python-editor-colors and fonts其实上一步有点多余,直接又返回到windows-preferences-general-appearance-c...
分类:
编程语言 时间:
2015-07-08 12:31:05
阅读次数:
2560
检测app使用了多少个xib和js的脚本(python)...
分类:
移动开发 时间:
2015-07-07 14:50:27
阅读次数:
157
目前 Linux 下有一些使用 Python 语言编写的 Linux 系统监控工具 比如 inotify-sync(文件系统安全监控软件)、glances(资源监控工具)在实际工作中,Linux 系统管理员可以根据自己使用的服务器的具体情况编写一下简单实用的脚本实现对 Linux 服务器的监控。 本...
分类:
编程语言 时间:
2015-07-05 21:03:19
阅读次数:
292
为Discuz! X3.2批量添加用户的python脚本...
分类:
编程语言 时间:
2015-07-02 19:30:07
阅读次数:
224
#!/usr/bin/python
a="a.txt"
f=file(a)
c=f.readlines()
whileTrue:
user_input=raw_input("plzinputyourname:").strip()
iflen(user_input)==0:continue
forlineinc:
ifuser_inputinline:
printline,
break
else:
print"itisnottheuser"
分类:
编程语言 时间:
2015-07-02 01:15:45
阅读次数:
154
今天在电脑上写了一个Python脚本,写好之后用ftp传上去,然后执行/var/www/cron.py,结果报错,/bin/usr/python: bad interpreter: No such file or directory,之前都是执行python/var/www/cron.py都没问题啊...
分类:
编程语言 时间:
2015-07-01 11:29:16
阅读次数:
159
#-*-coding:utf-8-*-
importsys
user="wangru"
counter=0
whileTrue:
ifcounter<3:
name=raw_input("pleaseinputyourname:").strip()
iflen(name)==0:
print"thenameisnull,tryagain"
continue
elifname==user:
pass
else:
print"theuser%sisnotrighttryagain"%name
coun..
分类:
编程语言 时间:
2015-07-01 06:24:31
阅读次数:
163