2024-04-30 20:50:25 +08:00
|
|
|
|
crontab 配置文件(每 20min 上传一次):
|
|
|
|
|
|
|
|
|
|
```text
|
|
|
|
|
*/20 * * * * [脚本绝对路径]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
脚本文件(记得调权限为 7xx):
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
source /etc/profile
|
|
|
|
|
cd /root
|
|
|
|
|
/usr/bin/git clone [仓库链接]
|
|
|
|
|
cd [仓库目录]
|
|
|
|
|
/usr/bin/git checkout [分支名]
|
|
|
|
|
/usr/bin/cp [测号器输出目录]/* .
|
|
|
|
|
/usr/bin/git add .
|
|
|
|
|
/usr/bin/git commit -m "auto commit"
|
|
|
|
|
/usr/bin/git push origin [分支名]
|
|
|
|
|
cd ..
|
|
|
|
|
/usr/bin/rm -rf [仓库目录]
|
|
|
|
|
```
|
|
|
|
|
|
2024-05-01 07:00:13 +08:00
|
|
|
|
使用前先上传 ssh 私钥并调权限,git config 后执行以下命令:
|
2024-04-30 20:50:25 +08:00
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
apt update && apt install cron
|
|
|
|
|
service cron start
|
|
|
|
|
crontab [配置文件]
|
2024-04-30 20:53:49 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**注意:上述配置完成后,请务必手动执行一次上传流程!否则 git 提交可能会卡在 ssh 新主机确认阶段**
|