This commit is contained in:
2025-07-29 10:55:17 +02:00
parent d1de8560de
commit c2e1542dc8

View File

@@ -173,13 +173,13 @@ while True:
logging.debug("Moving file {} into {}".format(filename, _FDEST)) logging.debug("Moving file {} into {}".format(filename, _FDEST))
mqtt_s.send_mqtt_message("sectorq/auto_import/job", {"status": "started","file":filename,"device":_DEV}) mqtt_s.send_mqtt_message("sectorq/auto_import/job", {"status": "started","file":filename,"device":_DEV})
try: try:
shutil.move("{}/{}".format(FULL_PATH,filename),_FDEST) shutil.copy("{}/{}".format(FULL_PATH,filename),_FDEST)
files_imported += 1 files_imported += 1
except: except:
try: try:
shutil.move("{}/{}".format(FULL_PATH,filename),"{}/{}".format(_FDEST,filename)) shutil.copy("{}/{}".format(FULL_PATH,filename),"{}/{}".format(_FDEST,filename))
files_imported += 1 files_imported += 1
except: except:
logging.debug("failed to move file {}".format(filename)) logging.debug("failed to move file {}".format(filename))
@@ -190,16 +190,19 @@ while True:
logging.debug(f"File: {file_or_dir}") logging.debug(f"File: {file_or_dir}")
mqtt_s.send_mqtt_message("sectorq/auto_import/job", {"status": "started","file":file_or_dir,"device":_DEV}) mqtt_s.send_mqtt_message("sectorq/auto_import/job", {"status": "started","file":file_or_dir,"device":_DEV})
try: try:
shutil.move("{}/{}".format(_DEV_DIR,file_or_dir),_FDEST) shutil.copy("{}/{}".format(_DEV_DIR,file_or_dir),_FDEST)
files_imported += 1 files_imported += 1
except: except:
try: try:
shutil.move("{}/{}".format(_DEV_DIR,file_or_dir),"{}/{}".format(_FDEST,file_or_dir)) shutil.copy("{}/{}".format(_DEV_DIR,file_or_dir),"{}/{}".format(_FDEST,file_or_dir))
files_imported += 1 files_imported += 1
except: except:
logging.debug("failed to move file {}".format(file_or_dir)) logging.debug("failed to move file {}".format(file_or_dir))
logging.debug("Umounting") logging.debug("Umounting")
myCmd = f"sudo umount {_DEV_MOUNT}" myCmd = f"sudo umount {_DEV_MOUNT}"
status, output = subprocess.getstatusoutput(myCmd) status, output = subprocess.getstatusoutput(myCmd)
logging.debug(output) logging.debug(output)