代码拉取完成,页面将自动刷新
同步操作将从 terrytan/opencron 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
#echo color
WHITE_COLOR="\E[1;37m";
RED_COLOR="\E[1;31m";
BLUE_COLOR='\E[1;34m';
GREEN_COLOR="\E[1;32m";
YELLOW_COLOR="\E[1;33m";
RES="\E[0m";
echo -ne "${GREEN_COLOR}"
cat<<EOT
--------------------------------------------
/ \\
/ ___ _ __ ___ _ __ ___ _ __ ___ _ __ \\
/ / _ \| '_ \ / _ \ '_ \ / __| '__/ _ \| '_ \\ \\
/ | (_) | |_) | __/ | | | (__| | | (_) | | | | \\
\\ \___/| .__/ \___|_| |_|\___|_| \___/|_| |_| /
\\ |_| /
\\ /
\\ --opencron,Let's crontab easy! /
--------------------------------------------
EOT
echo -ne "${RES}";
# OS specific support. $var _must_ be set to either true or false.
cygwin=false
darwin=false
os400=false
case "`uname`" in
CYGWIN*) cygwin=true;;
Darwin*) darwin=true;;
OS400*) os400=true;;
esac
# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
# Get standard environment variables
PRGDIR=`dirname "$PRG"`
WORKDIR="`readlink -f ${PRGDIR}`"
MAVEN_URL="http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz";
MAVEN_NAME="apache-maven-3.5.0-bin"
UNPKG_MAVEN_NAME="apache-maven-3.5.0";
OPENCRON_VERSION="1.1.0-RELEASE";
BUILD_HOME=${WORKDIR}/build
[ ! -d ${BUILD_HOME} ] && mkdir ${BUILD_HOME}
[ ! -d ${BUILD_HOME}/dist ] && mkdir ${BUILD_HOME}/dist/
rm -rf ${BUILD_HOME}/dist/*
function echo_r () {
# Color red: Error, Failed
[ $# -ne 1 ] && return 1
echo -e "[${GREEN_COLOR}opencron${RES}] ${RED_COLOR}$1${RES}"
}
function echo_g () {
# Color green: Success
[ $# -ne 1 ] && return 1
echo -e "[${GREEN_COLOR}opencron${RES}] ${GREEN_COLOR}$1${RES}"
}
function echo_y () {
# Color yellow: Warning
[ $# -ne 1 ] && return 1
echo -e "[${GREEN_COLOR}opencron${RES}] ${YELLOW_COLOR}$1${RES}"
}
function echo_w () {
# Color yellow: White
[ $# -ne 1 ] && return 1
echo -e "[${GREEN_COLOR}opencron${RES}] ${WHITE_COLOR}$1${RES}"
}
USER="`id -un`"
LOGNAME="$USER"
if [ $UID -ne 0 ]; then
echo_y "WARNING: Running as a non-root user, \"$LOGNAME\". Functionality may be unavailable. Only root can use some commands or options"
fi
#check java exists.
java >/dev/null 2>&1
if [ $? -ne 1 ];then
echo_r "ERROR: java is not install,please install java first!"
exit 1;
fi
#check maven exists
mvn >/dev/null 2>&1
if [ $? -ne 1 ]; then
echo_y "WARNING:maven is not install!"
if [ -x "${BUILD_HOME}/${UNPKG_MAVEN_NAME}" ] ; then
echo_w "maven is already download,now config setting...";
OPENCRON_MAVEN=${BUILD_HOME}/${UNPKG_MAVEN_NAME}/bin/mvn
else
echo_w "download maven Starting..."
echo_w "checking network connectivity ... "
net_check_ip=114.114.114.114
ping_count=2
ping -c ${ping_count} ${net_check_ip} >/dev/null
retval=$?
if [ ${retval} -eq 0 ] ; then
echo_w "network is connectioned,download maven Starting... "
wget -P ${BUILD_HOME} $MAVEN_URL && {
echo_g "download maven successful!";
echo_w "install maven Starting"
tar -xzvf ${BUILD_HOME}/${MAVEN_NAME}.tar.gz -C ${BUILD_HOME}
echo "
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<settings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd\">
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
</settings>" > ${BUILD_HOME}/${UNPKG_MAVEN_NAME}/conf/settings.xml
OPENCRON_MAVEN=${BUILD_HOME}/${UNPKG_MAVEN_NAME}/bin/mvn
}
elif [ ${retval} -ne 0 ]; then
echo_r "ERROR:network is blocked! download maven failed,please check your network!build error! bye!"
exit 1
fi
fi
elif [ "$OPENCRON_MAVEN"x = ""x ]; then
OPENCRON_MAVEN="mvn";
fi
echo_w "build opencron Starting...";
$OPENCRON_MAVEN clean install -Dmaven.test.skip=true;
retval=$?
if [ ${retval} -eq 0 ] ; then
cp ${WORKDIR}/opencron-agent/target/opencron-agent-${OPENCRON_VERSION}.tar.gz ${BUILD_HOME}/dist/
cp ${WORKDIR}/opencron-server/target/opencron-server.war ${BUILD_HOME}/dist/
echo -e "[${GREEN_COLOR}opencron${RES}] ${WHITE_COLOR}build opencron @ Version ${BLUE_COLOR}${OPENCRON_VERSION}${RES} successfully! please goto${RES} ${GREEN_COLOR}${BUILD_HOME}/dist${RES}"
exit 0
else
echo_r "build opencron failed! please try again "
exit 1
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。