From 156253f57891df73d73fb05c4bdf24c8845d9294 Mon Sep 17 00:00:00 2001 From: jonnybravo Date: Fri, 14 Apr 2023 16:38:11 +0200 Subject: [PATCH] commit message from python script --- check_and_add_pull_git/main.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/check_and_add_pull_git/main.py b/check_and_add_pull_git/main.py index a365beb..b99d5d5 100644 --- a/check_and_add_pull_git/main.py +++ b/check_and_add_pull_git/main.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 -import os, shutil, crontab, sys +import os, shutil, sys + +from crontab import CronTab def search_str(file_path, word): with open(file_path, 'r') as file: @@ -27,7 +29,11 @@ else: try: copy_file = shutil.copyfile(os.path.dirname(os.path.realpath(sys.argv[0])) + os.sep + "pull_and_push.py", user_bin + os.sep + "pull_and_push") - os.chmod(user_bin + os.sep + "pull_and_push",0o775) except FileExistsError: - print("File konnte nicht kopiert werden") \ No newline at end of file + print("File konnte nicht kopiert werden") + +cron = CronTab(user=os.environ["USER"]) +cron_job = cron.new(command='pull_and_push >> /var/log/pull_and_push.log') +cron_job.hours.every(17) +cron.write() \ No newline at end of file