我有一個名爲ssadmin.sh
的bash腳本,它管理另一個腳本sscounter.sh
。 我正在使用面料執行ssadmin.sh
。面料掛在遠程bash腳本時
沒有pty=False
:
def ts1():
with settings(warn_only=True):
run("chmod 775 %s" % 'ssadmin.sh')
run("%s start" % 'ssadmin.sh')
sscounter.sh
甚至無法啓動,但CMD不會被絞死:
[email protected]:~# /mithril/scripts/ss-bash/ssadmin.sh status
ssserver not running
sscounter.sh not running
與pty=False
:
def ts1():
with settings(warn_only=True):
run("chmod 775 %s" % 'ssadmin.sh')
run("%s start" % 'ssadmin.sh', pty=False)
[email protected]:~# /mithril/scripts/ss-bash/ssadmin.sh status
ssserver not running
10670 ? S 0:00 /bin/bash /mithril/scripts/ss-bash/sscounter.sh
sscounter.sh is running
sscounter.sh開始,但cmd掛起:
E:\[Sync]\project\walbk\fab>fab ts1
[192.168.1.181] Executing task 'ts1'
[192.168.1.181] run: chmod 775 /mithril/scripts/ss-bash/ssadmin.sh
[192.168.1.181] run: /mithril/scripts/ss-bash/ssadmin.sh start
[192.168.1.181] out: stdin: is not a tty
[192.168.1.181] out: 9915 ? S 0:00 /bin/bash /mithril/scripts/ss-bash/sscounter.sh
[192.168.1.181] out: sscounter.sh鍚姩涓?..
[192.168.1.181] out: 10670 ? S 0:00 /bin/bash /mithril/scripts/ss-bash/sscounter.sh
[192.168.1.181] out: sscounter.sh宸插惎鍔?
[192.168.1.181] out: (hang at here)
1.爲什麼織物掛起?
2. fabric pty description
: http://docs.fabfile.org/en/latest/usage/interactivity.html#echoes
pty is present to echo a user’s stdin
,爲什麼sscounter.sh
不會啓動時pty=True
?
什麼是sscounter.sh? –
@Padraic Cunningham它用於統計網絡流量https://github.com/hellofwy/ss-bash – Mithril