Compare commits

...

4 Commits

Author SHA1 Message Date
6107201331 commit message from python script 2023-04-14 17:54:48 +02:00
2d6e0298da commit message from python script 2023-04-14 17:18:01 +02:00
ca88a6af25 commit message from python script 2023-04-14 17:16:01 +02:00
780c7766da commit message from python script 2023-04-14 17:15:01 +02:00
2 changed files with 7 additions and 5 deletions

View File

@@ -18,7 +18,7 @@ def search_str(file_path, word):
user_bin = os.environ["HOME"] + os.sep + "bin" user_bin = os.environ["HOME"] + os.sep + "bin"
user_zshrc = os.environ["HOME"] + "/.zshrc" user_zshrc = os.environ["HOME"] + "/.zshrc"
my_logfile = os.sep + "var" + os.sep + "log" + os.sep + "pull_and_push.log" my_logfile = os.sep + "var" + os.sep + "log" + os.sep + "pull_and_push.log"
basic_command = "* */17 * * * " + "'pull_and_push >> " + my_logfile + "'" basic_command = "0 */10 * * * " + user_bin + os.sep + "pull_and_push >> " + my_logfile
print(basic_command) print(basic_command)
is_exist = False is_exist = False
@@ -38,7 +38,7 @@ except FileExistsError:
print("File konnte nicht kopiert werden") print("File konnte nicht kopiert werden")
cron = CronTab(user=os.environ["USER"]) 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: for item in basic_iter:
if str(item) == basic_command: if str(item) == basic_command:
print("crontab job already exist", item) print("crontab job already exist", item)
@@ -46,7 +46,7 @@ for item in basic_iter:
break break
if not is_exist: if not is_exist:
#test
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_job.every(10).hours()
cron.write() cron.write()

View File

@@ -40,6 +40,8 @@ class my_git():
my_git.git_push(self, git_folder=git_folder_s) my_git.git_push(self, git_folder=git_folder_s)
if __name__ == "__main__": if __name__ == "__main__":
check_time= datetime.datetime.now()
print(check_time.strftime("%H-%M"))
print(str(datetime.datetime.now()) + " start...") print(str(datetime.datetime.now()) + " start...")
check_my_git = my_git(check_folder= os.sep + "home" + os.sep + os.environ["USER"] + os.sep + "Projekte") check_my_git = my_git(check_folder= os.sep + "home" + os.sep + os.environ["USER"] + os.sep + "Projekte")
check_my_git.git_main() check_my_git.git_main()