Compare commits

...

3 Commits

Author SHA1 Message Date
a6b7b3891f commit message from python script 2023-09-03 18:03:21 +02:00
685bff204f commit message from python script 2023-09-03 18:02:31 +02:00
eeb5f526d1 commit message from python script 2023-09-03 17:58:27 +02:00

View File

@@ -2,7 +2,7 @@
import os, shutil, sys
from crontab import CronTab
#from crontab import CronTab
def search_str(file_path, word):
with open(file_path, 'r') as file:
@@ -37,16 +37,16 @@ try:
except FileExistsError:
print("File konnte nicht kopiert werden")
cron = CronTab(user=os.environ["USER"])
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)
is_exist=True
break
#cron = CronTab(user=os.environ["USER"])
#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)
# is_exist=True
# break
if not is_exist:
#if not is_exist:
#test
cron_job = cron.new(user_bin + os.sep + "pull_and_push >> " + my_logfile)
cron_job.every(10).hours()
cron.write()
# cron_job = cron.new(user_bin + os.sep + "pull_and_push >> " + my_logfile)
# cron_job.every(10).hours()
# cron.write()