forked from mirror/NitWikit
Merge pull request #233 from DeerGiteaMirror/main
优化Linux教程自动备份脚本,增加一些可能的报错解决方案
This commit is contained in:
commit
3740bb666a
@ -346,10 +346,10 @@ https://nitwikit.yizhan.wiki/
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/ColdeZhang">
|
<a href="https://zhangyuheng.lunadeer.cn/">
|
||||||
<img src="https://avatars.githubusercontent.com/u/29792376?v=4" width="50;" alt="ColdeZhang"/>
|
<img src="https://avatars.githubusercontent.com/u/29792376?v=4" width="50;" alt="ColdeZhang"/>
|
||||||
<br />
|
<br />
|
||||||
<sub><b>张宇衡</b></sub>
|
<sub><b>ZhangYuheng</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
|
@ -11,7 +11,7 @@ sidebar_position: 8
|
|||||||
sudo vim /root/backup.sh
|
sudo vim /root/backup.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
然后将以下内容粘贴到文件中,按实际情况与需要修改:
|
然后将以下内容粘贴到文件中,按实际情况与需要修改(如果你是Linux新手请不要修改):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
@ -86,7 +86,7 @@ SERVER_PARENT_DIR=$(dirname $SERVER_DIR)
|
|||||||
SERVER_NAME=$(basename $SERVER_DIR)
|
SERVER_NAME=$(basename $SERVER_DIR)
|
||||||
cd $SERVER_PARENT_DIR || exit
|
cd $SERVER_PARENT_DIR || exit
|
||||||
time=$(date "+%Y%m%d-%H%M%S")
|
time=$(date "+%Y%m%d-%H%M%S")
|
||||||
tar -czvf "${time}.tar.gz" --exclude="${SERVER_NAME}/session.lock" $SERVER_NAME
|
tar -czvf "${time}.tar.gz" $SERVER_NAME
|
||||||
mv "${time}.tar.gz" $BACKUP_DIR
|
mv "${time}.tar.gz" $BACKUP_DIR
|
||||||
|
|
||||||
# 删除多余的备份文件
|
# 删除多余的备份文件
|
||||||
@ -143,3 +143,7 @@ crontab -e
|
|||||||
2. 将备份文件解压:`tar -zxvf 备份文件名.tar.gz`;
|
2. 将备份文件解压:`tar -zxvf 备份文件名.tar.gz`;
|
||||||
3. 将解压后的文件覆盖到服务器目录:`cp -r 解压后的文件路径/* 服务器目录`。
|
3. 将解压后的文件覆盖到服务器目录:`cp -r 解压后的文件路径/* 服务器目录`。
|
||||||
|
|
||||||
|
> 如果你恢复存档后启动服务器报错:
|
||||||
|
> `[main/FATAL]: Failed to start the minecraft server net.minecraft.util.SessionLock$ExceptionWorldConfict: /home/minecraft/lobby/./world/session.lock: already locked (possibly by other Minecraft instance?)`
|
||||||
|
> 请检查 `world` 存档下是否存在 `session.lock` 文件,如果存在请删除,然后重启服务器。
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user