JDK进程查看jps工具(jpsx)

  1. cd /usr/local/bin
  2. sudo vi jpsx

脚本内容如下:

  1. #!/bin/bash
  2. # 检查集群进程状态
  3. for i in bigdata-node1 bigdata-node2 bigdata-node3
  4. do
  5. echo ------------------- $i --------------
  6. ssh $i "source /etc/profile;/home/vagrant/modules/jdk1.8.0_221/bin/jps"
  7. done

设置脚本执行权限:

  1. sudo chmod +x jpsx
  2. sudo chown vagrant:vagrant jpsx

分发(选做):

  1. # 使用root账户分发至其他节点
  2. sudo scp -r /usr/local/bin/jpsx root@bigdata-node2:/usr/local/bin/
  3. sudo scp -r /usr/local/bin/jpsx root@bigdata-node3:/usr/local/bin/