Hi Tom,
-- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. |
# Copyright (c) 2009-2015 Mike Revitt <m...@cougar.eu.com> # See the file LICENSE.txt for your rights.
import os.path import subprocess import datetime import getpass import weewx from weewx.engine import StdService # ============================================================================= # Class AWS_Sync # ============================================================================= class S3_Sync(StdService): def run(self): if 'HTML_ROOT' in self.skin_dict: local_root = os.path.join(self.config_dict['WEEWX_ROOT'], self.skin_dict['HTML_ROOT']) else: local_root = os.path.join(self.config_dict['WEEWX_ROOT'], self.config_dict['StdReport']['HTML_ROOT']) if 'LOG_FILE' in self.skin_dict: log_file = self.skin_dict['LOG_FILE'] else: log_file = "subprocess.PIPE" if 'DRY_RUN' in self.skin_dict: s3_cmd = 's3 sync --dryrun' else: s3_cmd = 's3 sync' s3_root = self.skin_dict['S3_ROOT'] aws = self.skin_dict['AWS'] cache_control = '--cache-control' cache_age = 'max-age=120' # 2 minutes LogFile = open(log_file, "a+") LogFile.write("\nWebsite Syncronisation Executed at %s by %s\n" %( datetime.datetime.now(), getpass.getuser())) command = subprocess.Popen([aws, s3_cmd, local_root, s3_root, cache_control, cache_age ], stdout = LogFile ) LogFile.close()
Had a chance to look at this today and followed the example for Alarm.py I have created a file, awscli.py and copied in the code from reportengine.py that was previously working under a new class S3_Sync I have added this line at the bottom of weewx.conf report_services = weewx.engine.StdPrint, weewx.engine.StdReport, user.awscli.S3_Sync and included a section with the heading [AwsCli] when I run the program my new awscli.py compiles, and gives compilation errors if I invalidate some of the code, but at run time it is not being called. Currently all it does is open a log file and write a line of code to it which is not happening. So I guess I have missed something. Any ideas
You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. |