just a bit more dynamic
This commit is contained in:
parent
7ac4b2fcce
commit
b605f8e1b8
@ -16,12 +16,14 @@ def compare_lists(docker_find, ovh_find):
|
|||||||
d.append(file_docker)
|
d.append(file_docker)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def files_to_move(files):
|
def files_to_move(files, directory):
|
||||||
for file in files:
|
for file in files:
|
||||||
file = file.decode("utf-8") str1 = f"docker cp debian-server:{file} ../gmod_zs/fastdl/maps/"
|
file = file.decode("utf-8")
|
||||||
#print(str1)
|
str1 = f"docker cp debian-server:{file} ../gmod_zs/fastdl/{directory}/"
|
||||||
|
#print(str1)
|
||||||
subprocess.Popen([str1], shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).communicate()[0]
|
subprocess.Popen([str1], shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).communicate()[0]
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
#find maps in docker
|
#find maps in docker
|
||||||
docker_find = subprocess.Popen(["docker exec debian-server find /home/gameservers_zs/gmod_zs_1/garrysmod/maps -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
|
docker_find = subprocess.Popen(["docker exec debian-server find /home/gameservers_zs/gmod_zs_1/garrysmod/maps -type f"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).communicate()[0].splitlines()
|
||||||
@ -30,6 +32,5 @@ if __name__ == "__main__":
|
|||||||
#if maps are in docker but not OVH we need to list them
|
#if maps are in docker but not OVH we need to list them
|
||||||
maps_to_move = compare_lists(docker_find, ovh_find)
|
maps_to_move = compare_lists(docker_find, ovh_find)
|
||||||
#move the files to OVH.
|
#move the files to OVH.
|
||||||
files_to_move(maps_to_move)
|
files_to_move(maps_to_move, "maps")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user