杀死某个进程的shell脚本kill_process.sh
#!/bin/bash
#kill_process.sh(杀死进程sh)
current_PID=$$
#ps -ef | grep "java" | grep -v "grep" | awk '{print
ps -aux | grep "/usr/sbin/httpd" | grep -v "grep" | awk '{print
for pid in `cat /tmp/${current_PID}.txt`
do
{
echo "kill -9 $pid"
kill -9 $pid
}
done
rm -f /tmp/${current_PID}.txt
启动某个jar包的shell脚本java_run.sh
pids=`ps -ef | grep "msger" | grep -v grep | awk '{print $2}'`
if [ "$pids" = "" ]
then
# export LANG=zh_CN
# export LC_ALL=zh_CN
MSGER_HOME=/amp/msger
PATH_SEPARATOR=:
CP=(ls MSGER_HOME/lib/*.jar |
paste -s -d"$PATH_SEPARATOR" - )
cd $MSGER_HOME
java -Xms512m -Xmx512m -cp $CP:classes cn.com.msger.Msger&
else
echo "Msger is already start,pid is:$pids"
fi