v2ray/cfddns/backup.sh

26 lines
663 B
Bash
Raw Normal View History

2019-01-13 14:46:02 +00:00
#! /bin/sh
# you can do something here
# this shell scripts will run at the end of build.py scripts
mkdir -p history
if [ ! -f ./history/version ];then
touch ./history/version
fi
version_old=`cat history/version | awk '{print $1}' | sort -rn |sed -n 1p`
version_new=`cat config.json.js |grep "version"|cut -d"\"" -f 4`
md5_old=`cat history/version | sort -nk1 | awk '{print $1}' |sed -n 1p`
2019-01-15 04:47:56 +00:00
md5_new=` md5sum cfddns.tar.gz | awk '{print $1}'`
2019-01-13 14:46:02 +00:00
2019-01-15 04:47:56 +00:00
if [ -f ./cfddns.tar.gz ];then
2019-01-13 14:46:02 +00:00
if [ "$version_old" != "$version_new" ];then
mkdir ./history/$version_new/
2019-01-15 04:47:56 +00:00
cp ./cfddns.tar.gz ./history/$version_new/
2019-01-13 14:46:02 +00:00
echo $version_new $md5_new >> ./history/version
fi
fi