shell 腳本遠程調用執行如下:
/usr/bin/ssh 10.1.2.3 '/bin/bash /root/ReServer.sh'
報錯如下:
Build step 'Execute shell' marked build as failure
本地執行是ok,怎麼執行都報錯,後來折騰了老半天,一步一步的打輸出,發現:
原來是腳本在判斷進程是否存在的同時,這個結束進程剛好有同樣的匹配串!
ps -aux | grep "idiot" | grep -v grep | grep -v '$$' | awk '{print $2}'
所以修改idiot,做精確匹配解決"sb idiot"