html tool

2017年7月4日星期二

pipeline use bash


问题:使用pipeline的sh无法使用bash 运行脚本很郁闷

go了半天也没解决,现在发现迂回一下使用writeFile把要执行的写入文件,使用bash 调用就ok了,

如下:

node(){
    def hostid=2
    sh "pwd"
    writeFile file: "_tmp", text: """
    #!/bin/bash
    date +"%F_%T">_1
    sleep 20
    ps -ef|grep slim_engine_test|grep 'cfg=check_0ue.cfg -host=${hostid}'|awk '{print \$2;system(\"kill -9 \"\$2)}' 
    date +"%F_%T">>_1
    """
    sh "nohup bash -x _tmp &"
    
}

没有评论:

发表评论