diff --git a/check_and_add_pull_git/main.py b/check_and_add_pull_git/main.py index d42cd17..f07c422 100644 --- a/check_and_add_pull_git/main.py +++ b/check_and_add_pull_git/main.py @@ -18,7 +18,7 @@ def search_str(file_path, word): user_bin = os.environ["HOME"] + os.sep + "bin" user_zshrc = os.environ["HOME"] + "/.zshrc" my_logfile = os.sep + "var" + os.sep + "log" + os.sep + "pull_and_push.log" -basic_command = "* */17 * * * " + "'pull_and_push >> " + my_logfile + "'" +basic_command = "* */17 * * * " + user_bin + os.sep + "pull_and_push >> " + my_logfile print(basic_command) is_exist = False @@ -38,7 +38,7 @@ except FileExistsError: print("File konnte nicht kopiert werden") cron = CronTab(user=os.environ["USER"]) -basic_iter = cron.find_command("pull_and_push >> " + my_logfile) +basic_iter = cron.find_command(user_bin + os.sep + "pull_and_push >> " + my_logfile) for item in basic_iter: if str(item) == basic_command: print("crontab job already exist", item) @@ -47,6 +47,6 @@ for item in basic_iter: if not is_exist: - cron_job = cron.new(command="'pull_and_push >> " + my_logfile + "'") + cron_job = cron.new(user_bin + os.sep + "pull_and_push >> " + my_logfile) cron_job.hours.every(17) cron.write() \ No newline at end of file