mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-01-08 00:49:24 +08:00
add try catch statement for chmod
This commit is contained in:
parent
3acabcc09d
commit
154c2cff8b
1 changed files with 9 additions and 8 deletions
|
@ -73,10 +73,7 @@ screen_width = get_arg("QBT_WIDTH", args.width, arg_int=True)
|
||||||
stats = {}
|
stats = {}
|
||||||
args = {}
|
args = {}
|
||||||
|
|
||||||
if os.path.isdir('/config'):
|
default_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config")
|
||||||
default_dir = '/config'
|
|
||||||
else:
|
|
||||||
default_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config")
|
|
||||||
|
|
||||||
for v in ['run','sch','config_file','log_file','cross_seed','recheck','cat_update','tag_update','rem_unregistered','rem_orphaned','tag_nohardlinks','skip_recycle','dry_run','log_level','divider','screen_width']:
|
for v in ['run','sch','config_file','log_file','cross_seed','recheck','cat_update','tag_update','rem_unregistered','rem_orphaned','tag_nohardlinks','skip_recycle','dry_run','log_level','divider','screen_width']:
|
||||||
args[v] = eval(v)
|
args[v] = eval(v)
|
||||||
|
@ -130,7 +127,10 @@ file_handler = RotatingFileHandler(file_logger, delay=True, mode="w", maxBytes=m
|
||||||
util.apply_formatter(file_handler)
|
util.apply_formatter(file_handler)
|
||||||
file_handler.addFilter(fmt_filter)
|
file_handler.addFilter(fmt_filter)
|
||||||
logger.addHandler(file_handler)
|
logger.addHandler(file_handler)
|
||||||
os.chmod(log_path, 0o777)
|
try:
|
||||||
|
os.chmod(log_path, 0o777)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
start_time = datetime.now()
|
start_time = datetime.now()
|
||||||
|
@ -224,7 +224,6 @@ def start():
|
||||||
|
|
||||||
def end():
|
def end():
|
||||||
logger.info("Exiting Qbit_manage")
|
logger.info("Exiting Qbit_manage")
|
||||||
os.chmod(file_logger, 0o777)
|
|
||||||
logger.removeHandler(file_handler)
|
logger.removeHandler(file_handler)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
@ -259,8 +258,10 @@ if __name__ == '__main__':
|
||||||
logger.debug(f" --divider (QBT_DIVIDER): {divider}")
|
logger.debug(f" --divider (QBT_DIVIDER): {divider}")
|
||||||
logger.debug(f" --width (QBT_WIDTH): {screen_width}")
|
logger.debug(f" --width (QBT_WIDTH): {screen_width}")
|
||||||
logger.debug("")
|
logger.debug("")
|
||||||
|
try:
|
||||||
os.chmod(file_logger, 0o777)
|
os.chmod(file_logger, 0o777)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
try:
|
try:
|
||||||
if run:
|
if run:
|
||||||
logger.info(f" Run Mode: Script will exit after completion.")
|
logger.info(f" Run Mode: Script will exit after completion.")
|
||||||
|
|
Loading…
Reference in a new issue