fabric 执行python脚本

xiaoxiao2021-02-28  17

1.local命令,当前服务器执行命令,

2.打印内容添加颜色

from fabric.api import * from fabric.colors import * def task4(): local('/usr/zookeeper/bin/zkServer.sh restart') local('/usr/zookeeper/bin/zkServer.sh status') def task5(): local('ls -ls /usr') def taskLocal(): task4() task5() def showColor(): print green('success') print red('fail') print yellow('yellow')执行脚本

[root@master ~]# fab -f fabtest.py showColor success fail yellow Done. [root@master ~]#

转载请注明原文地址: https://www.6miu.com/read-2150320.html

最新回复(0)