Programming/Java
Linux에서 Redirection 과 'top: failed tty get' 에러
OS : CentOS 7 Java 프로그램을 사용해서 리눅스 명령어를 실행하고, 결과 값을 받기위해서 테스트 프로그램을 작성했다. import java.io.*; import java.util.*; class Exec { public static void main(String[] args) throws IOException, InterruptedException{ String command = "top -n 1 | grep -i cpu\\(s\\) | awk '{print $2}'"; int lineCount = 0; String line = ""; Runtime rt = Runtime.getRuntime(); Process ps = null; try { ps = rt.exec(command); Buff..
2018. 10. 16. 16:41