maven清理
REPOSITORY_PATH 指定路径
set REPOSITORY_PATH=D:\repository
rem Searching now...
for /f "delims=" %%i in ('dir /b /s "%REPOSITORY_PATH%*lastUpdated"') do (
del /s /q %%i
)
for /f "delims=" %%i in ('dir /b /s "%REPOSITORY_PATH%*unknown"') do (
rmdir /s /q %%i
)
for /f "delims=" %%i in ('dir /b /s "%REPOSITORY_PATH%\unknown"') do (
rmdir /s /q %%i
)
for /f "delims=" %%i in ('dir /b /s "%REPOSITORY_PATH%*error*"') do (
rmdir /s /q %%i
)
for /f "delims=" %%i in ('dir /b /s "%REPOSITORY_PATH%\error"') do (
rmdir /s /q %%i
)
rem Clean success
pause
service.sh
#!/bin/sh
## java env
#export JAVA_HOME=/usr/local/jdk/jdk1.8.0_101
#export JRE_HOME=$JAVA_HOME/jre
APP_NAME=APP_NAME
JAR_NAME=APP_NAME.jar
LOG_NAME=$APP_NAME\.log
#PID pid
PID=$APP_NAME\.pid
OPSTION="-Xms1G -Xmx1G"
#tip msg
usage() {
echo "Usage: service.sh [start|stop|restart|status]"
exit 1
}
#check is exist
is_exist(){
pid=`ps -ef|grep $JAR_NAME|grep -v grep|awk '{print $2}' `
if [ -z "${pid}" ]; then
return 1
else
return 0
fi
}
#start
start(){
is_exist
if [ $? -eq "0" ]; then
echo ">>> ${JAR_NAME} is already running PID=${pid} <<<"
else
nohup java -jar $JAR_NAME --spring.profiles.active=dev >$LOG_NAME 2>&1 &
echo $! > $PID
echo ">>> start $JAR_NAME successed PID=$! <<<"
tail -f ./$LOG_NAME
fi
}
#stop
stop(){
#is_exist
pidf=$(cat $PID)
#echo "$pidf"
echo ">>> api PID = $pidf begin kill $pidf <<<"
kill $pidf
rm -rf $PID
sleep 4
is_exist
if [ $? -eq "0" ]; then
echo ">>> api 2 PID = $pid begin kill -9 $pid <<<"
kill -9 $pid
sleep 4
echo ">>> $JAR_NAME process stopped <<<"
else
echo ">>> ${JAR_NAME} is not running <<<"
fi
}
#check status
status(){
is_exist
if [ $? -eq "0" ]; then
echo ">>> ${JAR_NAME} is running PID is ${pid} <<<"
else
echo ">>> ${JAR_NAME} is not running <<<"
fi
}
#restart
restart(){
stop
sleep 5
start
}
#swich case
case "$1" in
"start")
start
;;
"stop")
stop
;;
"status")
status
;;
"restart")
restart
;;
*)
usage
;;
esac
exit 0