#!/usr/bin/env sh pid=`ps -ef | grep bill| grep java | awk '{print $2}'` if [ -n "$pid" ]; then echo $pid kill -9 $pid else echo "no running process" fi > nohup.out mvn clean package nohup java -jar target/bill-1.0.0-SNAPSHOT.jar 2>/dev/null & tail -f nohup.out