31 lines
613 B
Markdown
31 lines
613 B
Markdown
|
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 [仓库目录]
|
|||
|
```
|
|||
|
|
|||
|
使用前先上传 ssh 私钥并调权限,然后执行以下命令:
|
|||
|
|
|||
|
```shell
|
|||
|
apt update && apt install cron
|
|||
|
service cron start
|
|||
|
crontab [配置文件]
|
|||
|
```
|