Process proc1 ='sh -c ps -ef'.execute();
Process proc2 ='sh -c grep sleep.sh '.execute();
Process proc3 ='sh -c grep -v grep '.execute();
Process proc4 ='sh -c awk sleep.sh '.execute();
Process all = proc1 | proc2 | proc3 | proc4;
// I tried this too and this didnt work
//println( [ 'sh', '-c', 'ps -ef | grep "sleep.sh" | grep -v "grep" | awk "sleep.groovy" ' ].execute().text )
//also tried without the awk
println all.text;
Okay so what I am trying to do is ps the shell script i made (sleep.sh) [all it does it sleep for a period of time]. Not quite sure how to do that. This was my best guess^^
result:
-sh-3.2$ ./callGroovy.sh testSleep.groovy
-sh-3.2$
doesnt print anything out and doesnt give me anything (callGroovy is a shell script i use to call my groovy script) If i run the piped commands they work still except the awk I think i am doing the awk wrong heres the rest piped
-sh-3.2$ ps -ef | grep "sleep.sh" | grep -v "grep"
wasadmin ***** ***** 0 **:** pts/1 **:**:** /bin/bash ./sleep.sh
(where all the * are numbers)
when i try the script with just the grep and ps it doesnt give me this output either. any suggestions? ..PS Also I tried with and without the quotes in the groovy script. Didnt think it would make a difference but worth a shot