File size: 486 Bytes
7dc50ff
 
8edc1d5
7dc50ff
 
57fe683
 
 
 
 
 
 
 
 
7dc50ff
 
fc9f187
7dc50ff
8edc1d5
57fe683
 
7dc50ff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

# 定义源路径(监控目录)
SOURCE="/sillytavern/"

# 获取 host 和 port 参数
if [ "$#" -ne 2 ]; then
    echo "Usage: $0 <host> <port>"
    exit 1
fi

HOST="$1"
PORT="$2"

# 使用 inotifywait 监控源目录的变化
while true; do
    # 等待文件创建、修改或删除事件。
    inotifywait -r -e modify,create,delete "$SOURCE"
    
    # 执行 Python 脚本,并传递 host 和 port 参数
    python /rsync.py --host "$HOST" --port "$PORT"
done