diff --git a/coretex/cli/modules/cron.py b/coretex/cli/modules/cron.py index 059a1282..e504f335 100644 --- a/coretex/cli/modules/cron.py +++ b/coretex/cli/modules/cron.py @@ -33,12 +33,13 @@ def getExisting() -> List[str]: def jobExists(script: str) -> bool: existingLines = getExisting() - return any(line.endswith(script) for line in existingLines) + return any(script in line for line in existingLines) def scheduleJob(scriptName: str) -> None: existingLines = getExisting() - existingLines.append(f"*/30 * * * * {CONFIG_DIR / scriptName} >> {CONFIG_DIR}/logs/ctx_autoupdate.log 2>&1\n") + cronJob = f"*/30 * * * * {CONFIG_DIR / scriptName} >> {CONFIG_DIR}/logs/ctx_autoupdate.log 2>&1\n" + existingLines.append(cronJob) tempCronFilePath = CONFIG_DIR / "temp.cron" with tempCronFilePath.open("w") as tempCronFile: diff --git a/coretex/cli/modules/update.py b/coretex/cli/modules/update.py index 2d8c6995..d531dffd 100644 --- a/coretex/cli/modules/update.py +++ b/coretex/cli/modules/update.py @@ -65,7 +65,7 @@ def activateAutoUpdate() -> None: updateScriptPath = DEFAULT_VENV_PATH.parent / UPDATE_SCRIPT_NAME dumpScript(updateScriptPath) - if not jobExists(UPDATE_SCRIPT_NAME): + if not jobExists(str(updateScriptPath)): scheduleJob(UPDATE_SCRIPT_NAME)