Qilan2 commited on
Commit
6e8e1cf
·
verified ·
1 Parent(s): 32bf9a6

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +6 -6
server.py CHANGED
@@ -24,20 +24,19 @@ local_port = 873
24
  remote_port = 7075
25
  """
26
  script_content = f"""#!/bin/bash
27
-
28
  # 定义源和目标路径
29
  SOURCE="/sillytavern/"
30
  DESTINATION="root@{frp_url}:/sillytavern/"
31
  PORT={ssh_port}
32
- PASSWORD="qilan" # 将你的密码放在这里
33
-
34
  # 使用 inotifywait 监控源目录的变化
35
  while true; do
36
  # 等待文件创建、修改或删除事件,并执行 rsync 同步命令。
37
  inotifywait -r -e modify,create,delete "$SOURCE"
38
- # 执行 rsync 同步命令,使用 sshpass 自动输入密码。
39
- rsync -avzP -e "ssh -p $PORT -o StrictHostKeyChecking=no" "$SOURCE" "$DESTINATION"
40
- done
 
 
41
  """
42
  kaggle_metadata = {
43
  "title": "Your Dataset Title",
@@ -53,6 +52,7 @@ import requests
53
  import json
54
  import threading
55
  import time
 
56
  import glob # 导入 glob 模块
57
  from requests.adapters import HTTPAdapter
58
  from requests.packages.urllib3.util.retry import Retry
 
24
  remote_port = 7075
25
  """
26
  script_content = f"""#!/bin/bash
 
27
  # 定义源和目标路径
28
  SOURCE="/sillytavern/"
29
  DESTINATION="root@{frp_url}:/sillytavern/"
30
  PORT={ssh_port}
 
 
31
  # 使用 inotifywait 监控源目录的变化
32
  while true; do
33
  # 等待文件创建、修改或删除事件,并执行 rsync 同步命令。
34
  inotifywait -r -e modify,create,delete "$SOURCE"
35
+ echo "Change detected at $(date). Syncing..."
36
+ # 执行 rsync 同步命令,使用 sshpass 自动输入密码(如果需要)
37
+ rsync -avzP --delete -e "ssh -p $PORT -o StrictHostKeyChecking=no" "$SOURCE" "$DESTINATION"
38
+ echo "Sync completed at $(date)."
39
+ done
40
  """
41
  kaggle_metadata = {
42
  "title": "Your Dataset Title",
 
52
  import json
53
  import threading
54
  import time
55
+ import pexpect
56
  import glob # 导入 glob 模块
57
  from requests.adapters import HTTPAdapter
58
  from requests.packages.urllib3.util.retry import Retry