File size: 1,316 Bytes
7ce8cfd 48adc1f 7ce8cfd f9a04a4 43e8605 f9a04a4 7ce8cfd 084f8fd a88eec3 084f8fd a41414c 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 54 55 56 57 58 |
#!/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 /data
#chmod 777 /data
cd /data
#git init
#git config user.email "[email protected]"
#git config user.name "git-batch"
#git config init.defaultBranch main
#git branch -m main
#git remote add origin https://${github_secret}@github.com/${github_project}.git
git clone https://${github_secret}@github.com/${github_project}.git .
git config --add safe.directory /data
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
|