automated terminal push
This commit is contained in:
@@ -30,6 +30,8 @@ def buildLogFileName():
|
||||
|
||||
node_id= logFileDir + "yankee-node-" + server_ip + "-" + server_hostname + ".log"
|
||||
|
||||
node_id= "/root/Desktop/consumer.log"
|
||||
|
||||
return node_id
|
||||
|
||||
except socket.gaierror:
|
||||
@@ -54,6 +56,8 @@ def buildCronExecuteTime():
|
||||
|
||||
def buildCronSituation():
|
||||
|
||||
return buildCronExecuteTime() +"/yankee-gnome-fire-consumer/consumer.bash >> " + buildLogFileName() + " 2>&1"
|
||||
|
||||
return buildCronExecuteTime() +" python3 /yankee-gnome-fire-consumer/consumer.py >> " + buildLogFileName() + " 2>&1"
|
||||
|
||||
####
|
||||
@@ -111,8 +115,9 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
* * * * * /tmp/ping2.bash >> /var/log/cron.log 2>&1"""
|
||||
|
||||
try:
|
||||
# Check if the file exists and delete if it does
|
||||
|
||||
if os.path.exists(file_path):
|
||||
|
||||
os.remove(file_path)
|
||||
|
||||
with open(file_path, "w") as f:
|
||||
@@ -134,9 +139,9 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
f.write(sep)
|
||||
f.write(sep)
|
||||
|
||||
f.write("* * * * * /yankee-gnome-fire-consumer/consumer.bash >> /var/log/consumer.log 2>&1")
|
||||
f.write(sep)
|
||||
f.write(sep)
|
||||
#worksf.write("* * * * * /yankee-gnome-fire-consumer/consumer.bash >> /var/log/consumer.log 2>&1")
|
||||
#f.write(sep)
|
||||
#f.write(sep)
|
||||
|
||||
print(f"Crontab written to '{file_path}' successfully.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user