同步文件
This commit is contained in:
parent
0962af6579
commit
2520bf558b
1 changed files with 19 additions and 0 deletions
19
manage.py
19
manage.py
|
@ -1,6 +1,7 @@
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from json import dump
|
from json import dump
|
||||||
|
import subprocess
|
||||||
|
|
||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
|
|
||||||
|
@ -49,3 +50,21 @@ def generate_db(config: ConfigParser) -> None:
|
||||||
|
|
||||||
|
|
||||||
generate_db(config)
|
generate_db(config)
|
||||||
|
|
||||||
|
sync_all_command = [
|
||||||
|
config["ftp"]["lftp"],
|
||||||
|
f'-e mirror -R -e --parallel=10 {config["file"]["local"]} {config["file"]["remote"]}; exit',
|
||||||
|
"-u",
|
||||||
|
f'{config["ftp"]["user"]},{config["ftp"]["pass"]}',
|
||||||
|
config["ftp"]["host"],
|
||||||
|
]
|
||||||
|
|
||||||
|
sync_files_command = [
|
||||||
|
config["ftp"]["lftp"],
|
||||||
|
f'-e mirror -R -e --parallel=10 {config["file"]["local"]}/categories {config["file"]["remote"]}/categories; exit',
|
||||||
|
"-u",
|
||||||
|
f'{config["ftp"]["user"]},{config["ftp"]["pass"]}',
|
||||||
|
config["ftp"]["host"],
|
||||||
|
]
|
||||||
|
|
||||||
|
print(subprocess.run(sync_files_command))
|
||||||
|
|
Loading…
Reference in a new issue