File size: 1,180 Bytes
7ce8cfd c7b5034 7ce8cfd 7102b15 7ce8cfd 7102b15 7ce8cfd c7b5034 7102b15 7ce8cfd 7102b15 57b0256 7ce8cfd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
#!/bin/sh
function env() {
if [[ ! -z "${fetch}" ]]; then
echo '远程获取参数...'
curl -s "$fetch" -o data.json
export github_secret=$(jq -r .github_secret data.json)
export github_project=$(jq -r .github_project data.json)
fi
echo
echo "fetch = ${fetch}"
echo "github_secret = $github_secret"
echo "github_project = $github_project"
echo
echo
sed -i "s/\[github_secret\]/${github_secret}/g" launch.sh
sed -i "s#\[github_project\]#${github_project}#g" launch.sh
}
function init() {
mkdir -p /data
cd /data
git config --global user.email "[email protected]"
git config --global user.name "git-batch"
git config --global init.defaultBranch main
git init
git remote add origin https://[github_secret]@github.com/[github_project].git
git add .
echo "'update data $(date "+%Y-%m-%d %H:%M:%S")'"
git commit -m "'update data $(date "+%Y-%m-%d %H:%M:%S")'"
git pull origin main
cd /
chmod -R 777 data
nohup ./git-batch --commit 10s --name git-batch --email [email protected] --push 1m -p data > access.log 2>1 &
}
case $1 in
env)
env
;;
init)
init
;;
start)
init
/one-api
;;
esac
|