私自搭建私服務nexus-2.14.14-01 啓動 重啓 關閉服務
創建 startup.sh 腳本,具體內容如下:
#!/bin/bash
APP_PAHT="/data/soft/nexus"
NEXUS_PAHT="nexus-2.14.14-01"
COMMAND="$1"
if [[ "$COMMAND" != "start" ]] && [[ "$COMMAND" != "stop" ]] && [[ "$COMMAND" != "restart" ]]; then
echo "Usage: $0 start | stop | restart"
exit 0
fi
BASE_DIR=$(cd `dirname $0`; pwd)
RUN_PATH="${BASE_DIR}/${NEXUS_PATH}"
echo " ${RUN_PATH}"
if [ ! -d "${RUN_PATH}/logs" ]; then
mkdir ${RUN_PATH}/logs
fi
echo " ${BASE_DIR}"
# check the start.out log output file
if [ ! -f "${RUN_PATH}/logs/wrapper.log" ]; then
touch "${RUN_PATH}/logs/wrapper.log "
fi
function start()
{
nexus-2.14.14-01/bin/nexus restart
echo "--------nexus 私服務啓動成功--------"
echo "--------歡迎使用sixeco 廣州私服 CRM ^_^--------"
tail -f ${NEXUS_PAHT}/logs/wrapper.log
}
function stop()
{
P_ID=`ps -ef | grep -w 'nexus' | grep -v "grep" | awk '{print $2}'`
kill $P_ID
echo "P_ID ${P_ID} 私服務已關閉"
}
if [[ "$COMMAND" == "start" ]]; then
start
elif [[ "$COMMAND" == "stop" ]]; then
stop
else
stop
start
fi