Update sync.sh
Browse files
sync.sh
CHANGED
|
@@ -3,12 +3,20 @@
|
|
| 3 |
# 定义源路径(监控目录)
|
| 4 |
SOURCE="/sillytavern/"
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
# 使用 inotifywait 监控源目录的变化
|
| 7 |
while true; do
|
| 8 |
# 等待文件创建、修改或删除事件。
|
| 9 |
inotifywait -r -e modify,create,delete "$SOURCE"
|
| 10 |
|
| 11 |
-
# 执行 Python
|
| 12 |
-
python /rsync.py
|
| 13 |
-
|
| 14 |
done
|
|
|
|
| 3 |
# 定义源路径(监控目录)
|
| 4 |
SOURCE="/sillytavern/"
|
| 5 |
|
| 6 |
+
# 获取 host 和 port 参数
|
| 7 |
+
if [ "$#" -ne 2 ]; then
|
| 8 |
+
echo "Usage: $0 <host> <port>"
|
| 9 |
+
exit 1
|
| 10 |
+
fi
|
| 11 |
+
|
| 12 |
+
HOST="$1"
|
| 13 |
+
PORT="$2"
|
| 14 |
+
|
| 15 |
# 使用 inotifywait 监控源目录的变化
|
| 16 |
while true; do
|
| 17 |
# 等待文件创建、修改或删除事件。
|
| 18 |
inotifywait -r -e modify,create,delete "$SOURCE"
|
| 19 |
|
| 20 |
+
# 执行 Python 脚本,并传递 host 和 port 参数
|
| 21 |
+
python /rsync.py --host "$HOST" --port "$PORT"
|
|
|
|
| 22 |
done
|