只用修改input1的值即可
#!/bin/bash
input1=repay-1.0-SNAPSHOT.war
DATE=$(date +%Y%m%d%H%M%S)
echo "process name : $input1"
PID=$(ps -ef | grep $input1 | grep -v grep | awk '{print $2}')
echo "PID:$PID"
if [[ $PID -ne 0 ]]; then
echo "process id:$PID"
else
echo "process $input1 not exit"
exit
fi
kill -9 ${PID}
if [ ! -d bak ];then
mkdir -p bak
fi
mv $input1 bak/$input1$DATE
if [ $? -eq 0 ];then
echo "kill $input1 success"
else
echo "kill $input1 fail"
fi