Compare commits
11 Commits
tag/autolo
...
timed
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9aa071a32d | ||
|
|
8033b7a57b | ||
|
|
be3461d4a5 | ||
|
|
92577c120f | ||
|
|
f9605dbce3 | ||
|
|
962f35d2e9 | ||
|
|
70be610e92 | ||
|
|
f2c499cebc | ||
|
|
4a5b66ec21 | ||
|
|
2686c62bda | ||
|
|
4272418cb0 |
@@ -6,16 +6,10 @@ set -x
|
||||
|
||||
##
|
||||
|
||||
echo "what up????"
|
||||
echo "init > consumer.bash"
|
||||
|
||||
####
|
||||
|
||||
cd /yankee-gnome-fire-consumer
|
||||
|
||||
pwd
|
||||
|
||||
ls
|
||||
|
||||
whoami
|
||||
|
||||
python3 consumer.py
|
||||
|
||||
21
consumer.py
21
consumer.py
@@ -2,6 +2,8 @@ import stomp
|
||||
import time
|
||||
import SullyGnomeRobot
|
||||
import RestAPIClient
|
||||
import os
|
||||
import signal
|
||||
|
||||
print("## ")
|
||||
print("## starting > JMS consumer (yankee-sully-channels-monthly)")
|
||||
@@ -60,9 +62,10 @@ class MyListener(stomp.ConnectionListener):
|
||||
RestAPIClient.addDownloadFailure(message.body, "error from onmessage (consumer.py)")
|
||||
|
||||
print("## ")
|
||||
print("## starting > JMS consumer (yankee-sully-channels-monthly)")
|
||||
print("## starting > (timed) JMS consumer (yankee-sully-channels-monthly)")
|
||||
print("## ")
|
||||
|
||||
|
||||
conn = stomp.Connection([('67.220.70.106', 61613)])
|
||||
|
||||
conn.set_listener('', MyListener())
|
||||
@@ -75,10 +78,24 @@ print("## ")
|
||||
print("## notification > connected to JMS server (yankee-sully-channels-monthly) 3333")
|
||||
print("## ")
|
||||
|
||||
while True:
|
||||
start_time = time.time()
|
||||
|
||||
print("start time /",start_time)
|
||||
|
||||
counter=0
|
||||
|
||||
while time.time() - start_time < 60:
|
||||
|
||||
counter = counter + 1
|
||||
|
||||
pass
|
||||
|
||||
print("waiting for 60 seconds of elapsed time: ",counter)
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
print("it's been 60 seconds. what up though?")
|
||||
|
||||
conn.disconnect()
|
||||
|
||||
print("disconnected from JMS. i'll holla!")
|
||||
|
||||
7
crontabX
Normal file
7
crontabX
Normal file
@@ -0,0 +1,7 @@
|
||||
SHELL=/bin/bash
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
* * * * * /yankee-gnome-fire-consumer/consumer.bash >> /var/log/yankee.log
|
||||
|
||||
* * * * * /yankee-gnome-fire-consumer/ping.bash >> /var/log/cron.log 2>&1
|
||||
|
||||
@@ -28,7 +28,9 @@ def buildLogFileName():
|
||||
|
||||
print("server_hostname / ",server_hostname)
|
||||
|
||||
node_id= logFileDir + "yankee-node-" + server_ip + "-" + server_hostname + ".log"
|
||||
#node_id=logFileDir + "yankee-node-" + server_ip + "-" + server_hostname + ".log"
|
||||
|
||||
node_id= "/var/log/yankee.log"
|
||||
|
||||
return node_id
|
||||
|
||||
@@ -48,13 +50,19 @@ def buildCronExecuteTime():
|
||||
|
||||
print("new_hour / ",new_hour)
|
||||
|
||||
cron = str(new_minute) + " " + str(new_hour) + " " + "* * *"
|
||||
cron = str(new_minute) + " " + str(new_hour) + " " + "* * * "
|
||||
|
||||
return cron
|
||||
|
||||
def buildCronSituation():
|
||||
|
||||
return buildCronExecuteTime() +" python3 /yankee-gnome-fire-consumer/consumer.py >> " + buildLogFileName() + " 2>&1"
|
||||
return "* * * * * /yankee-gnome-fire-consumer/consumer.bash >> " + buildLogFileName()
|
||||
|
||||
##return buildCronExecuteTime() + "/yankee-gnome-fire-consumer/consumer.bash >> " + buildLogFileName()
|
||||
|
||||
##return buildCronExecuteTime() +"/yankee-gnome-fire-consumer/consumer.bash >> " + buildLogFileName() + " 2>&1"
|
||||
|
||||
##return buildCronExecuteTime() +" python3 /yankee-gnome-fire-consumer/consumer.py >> " + buildLogFileName() + " 2>&1"
|
||||
|
||||
####
|
||||
|
||||
@@ -103,16 +111,10 @@ def writeCrontabSituation():
|
||||
|
||||
file_path ="crontabX"
|
||||
|
||||
crontab_text = """
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
* * * * * python3 /yankee-gnome-fire-consumer/consumer.py >> /var/log/yankee-downloader.log 2>&1
|
||||
|
||||
* * * * * /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 +136,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.")
|
||||
|
||||
@@ -150,6 +152,6 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
####################
|
||||
|
||||
createLogDir()
|
||||
#createLogDir()
|
||||
|
||||
writeCrontabSituation()
|
||||
|
||||
Reference in New Issue
Block a user