Shell Script to kill all java processes on different hosts
Shell Script to kill all java processes on different hosts.
The scripts assumes auto login using shh is enabled. The steps are explained here
#!/bin/bash
####################################
# Set These Values to correspond to your environment
####################################
BLHOSTS=(linhtr1 linhtr2 linhtr3 linhtr4);
SH_CMD=ssh
####################################
SCRIPT_HOME=`dirname $0`
for host in ${BLHOSTS[@]}; do
echo $SH_CMD $host "ps -ef | grep java|cut -b10-15|xargs kill -9"
$SH_CMD $host "ps -ef | grep java|cut -b10-15|xargs kill -9"
done
The scripts assumes auto login using shh is enabled. The steps are explained here
#!/bin/bash
####################################
# Set These Values to correspond to your environment
####################################
BLHOSTS=(linhtr1 linhtr2 linhtr3 linhtr4);
SH_CMD=ssh
####################################
SCRIPT_HOME=`dirname $0`
for host in ${BLHOSTS[@]}; do
echo $SH_CMD $host "ps -ef | grep java|cut -b10-15|xargs kill -9"
$SH_CMD $host "ps -ef | grep java|cut -b10-15|xargs kill -9"
done
Comments
Post a Comment