杀死某个进程的shell脚本kill_process.sh
#!/bin/bash
#kill_process.sh(杀死进程sh)
current_PID=$$
#ps -ef | grep "java" | grep -v "grep" | awk '{print $2}' > /tmp/${current_PID}.txt
ps -aux | grep "/usr/sbin/httpd" | grep -v "grep" | awk '{print $2}' > /tmp/${current_PID}.txt
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
分享两个shell脚本关闭和启动
转载下一篇:liunx安装cvs

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章