Skip to content

Commit

Permalink
Add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbeevip committed Nov 6, 2023
1 parent c916012 commit 4438ff3
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
import logging
import os
import time
from datetime import datetime

import schedule

from aws_lightsail_guard.guard import guard


def job_wrapper():
current_hour = datetime.now().hour
if 6 <= current_hour < 24:
guard.lightsail_instance_public_ip_keepalive(name=os.environ['LIGHTSAIL_INSTANCE_NAME'])
else:
logging.info('Skip')
guard.lightsail_instance_public_ip_keepalive(name=os.environ['LIGHTSAIL_INSTANCE_NAME'])


if __name__ == '__main__':
schedule.every(1).minutes.do(job_wrapper)
schedule.every(5).minutes.do(job_wrapper)

while True:
schedule.run_pending()
Expand Down

0 comments on commit 4438ff3

Please sign in to comment.