commit message from python script
This commit is contained in:
@@ -17,6 +17,10 @@ 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"
|
||||||
|
basic_command = "* */17 * * * pull_and_push >> " + my_logfile
|
||||||
|
print(basic_command)
|
||||||
|
is_exist = False
|
||||||
|
|
||||||
if not os.path.exists(user_bin):
|
if not os.path.exists(user_bin):
|
||||||
os.mkdir(user_bin)
|
os.mkdir(user_bin)
|
||||||
@@ -34,6 +38,15 @@ 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"])
|
||||||
cron_job = cron.new(command='pull_and_push >> /var/log/pull_and_push.log')
|
basic_iter = cron.find_command("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:
|
||||||
|
|
||||||
|
cron_job = cron.new(command="pull_and_push >> " + my_logfile)
|
||||||
cron_job.hours.every(17)
|
cron_job.hours.every(17)
|
||||||
cron.write()
|
cron.write()
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os, git
|
import os, git, datetime
|
||||||
|
|
||||||
class my_git():
|
class my_git():
|
||||||
def __init__(self, check_folder = str) -> None:
|
def __init__(self, check_folder = str) -> None:
|
||||||
@@ -40,5 +40,7 @@ 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__":
|
||||||
|
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()
|
||||||
|
print(str(datetime.datetime.now()) + "...end")
|
||||||
|
|||||||
Reference in New Issue
Block a user