linux 中查看进程总数:
echo.sh
ps -ef | grep carte.sh | wc -l
程序:执行Linux上的shell脚本,获取进程数
package com.pasier.xxx.util;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ch.ethz.ssh2.ChannelCondition;
import ch.ethz.ssh2.Connection;
import ch.ethz.ssh2.Session;
import ch.ethz.ssh2.StreamGobbler;
public class RmtShellExecutor {
private static final Logger LOG = LoggerFactory
.getLogger(RmtShellExecutor.class);
private Connection conn;
private String ip;
private String usr;
private String psword;
private String charset = Charset.defaultCharset().toString();
private static final int TIME_OUT = 1000 * 5 * 60;
public RmtShellExec