Files
tunnel/bin/kill.sh
2023-03-25 09:06:37 +08:00

37 lines
536 B
Bash

#!/bin/bash
#
#
#
init()
{
DB_PORT=$1
}
main()
{
PROCESS=`ps -axww | grep tunnel | grep ${DB_PORT} | grep "\-f" | awk '{print $1}'`
if test "${PROCESS}" = ""; then
echo "进程不存在!!!"
exit -1
fi
echo "重启参数:" `./cmdline $PROCESS | sed "s|-f|-d -f|g"`
echo "关闭进程: $PROCESS, 关闭端口: ${DB_PORT}"
kill `ps -ax | grep tunnel | grep ${DB_PORT} | awk '{print $1}' | xargs `
}
if test "$1" = ""; then
echo "参数错误!"
exit -1
fi
init $1
main