diff --git a/consumer (copy 2).py b/consumer (copy 2).py new file mode 100644 index 0000000..8577230 --- /dev/null +++ b/consumer (copy 2).py @@ -0,0 +1,17 @@ + + +print("## ") +print("## starting > JMS consumer (yankee-sully-channels-monthly)") +print("## ") + + + + + + + + +print("## ") +print("## notification > connected to JMS server (yankee-sully-channels-monthly)") +print("## ") + diff --git a/consumer (copy 3).py b/consumer (copy 3).py new file mode 100644 index 0000000..8577230 --- /dev/null +++ b/consumer (copy 3).py @@ -0,0 +1,17 @@ + + +print("## ") +print("## starting > JMS consumer (yankee-sully-channels-monthly)") +print("## ") + + + + + + + + +print("## ") +print("## notification > connected to JMS server (yankee-sully-channels-monthly)") +print("## ") + diff --git a/consumer (copy 4).py b/consumer (copy 4).py new file mode 100644 index 0000000..8577230 --- /dev/null +++ b/consumer (copy 4).py @@ -0,0 +1,17 @@ + + +print("## ") +print("## starting > JMS consumer (yankee-sully-channels-monthly)") +print("## ") + + + + + + + + +print("## ") +print("## notification > connected to JMS server (yankee-sully-channels-monthly)") +print("## ") + diff --git a/consumer.py b/consumer.py index 8577230..d58181d 100644 --- a/consumer.py +++ b/consumer.py @@ -1,17 +1,44 @@ +def write_to_file(filepath, content): + """Writes content to a file. + + Args: + filepath: The path to the file. + content: The string to write to the file. + Returns: + True on success, False on failure. Prints error messages. + """ + try: + with open(filepath, 'w') as f: # 'w' mode overwrites, 'a' appends + f.write(content) + return True + except OSError as e: + print(f"Error writing to file {filepath}: {e}") + return False -print("## ") -print("## starting > JMS consumer (yankee-sully-channels-monthly)") -print("## ") +# Example usage: +filepath = "/tmp/file.dat" # Or any path you want +content = "yooo" + +if write_to_file(filepath, content): + print(f"Successfully wrote '{content}' to {filepath}") +else: + print("File write operation failed.") +# Example of appending: +def append_to_file(filepath, content): + """Appends content to a file.""" + try: + with open(filepath, 'a') as f: # 'a' mode appends + f.write(content) + return True + except OSError as e: + print(f"Error appending to file {filepath}: {e}") + return False - - - - - -print("## ") -print("## notification > connected to JMS server (yankee-sully-channels-monthly)") -print("## ") - +# Example usage of append: +if append_to_file(filepath, "\nand more yooo"): # \n for a new line + print("Successfully appended to the file.") +else: + print("File append operation failed.") diff --git a/file.dat b/file.dat new file mode 100644 index 0000000..393994f --- /dev/null +++ b/file.dat @@ -0,0 +1,2 @@ +yooo +and more yooo \ No newline at end of file diff --git a/schedule.py b/schedule.py new file mode 100644 index 0000000..d58181d --- /dev/null +++ b/schedule.py @@ -0,0 +1,44 @@ +def write_to_file(filepath, content): + """Writes content to a file. + + Args: + filepath: The path to the file. + content: The string to write to the file. + Returns: + True on success, False on failure. Prints error messages. + """ + try: + with open(filepath, 'w') as f: # 'w' mode overwrites, 'a' appends + f.write(content) + return True + except OSError as e: + print(f"Error writing to file {filepath}: {e}") + return False + + +# Example usage: +filepath = "/tmp/file.dat" # Or any path you want +content = "yooo" + +if write_to_file(filepath, content): + print(f"Successfully wrote '{content}' to {filepath}") +else: + print("File write operation failed.") + + +# Example of appending: +def append_to_file(filepath, content): + """Appends content to a file.""" + try: + with open(filepath, 'a') as f: # 'a' mode appends + f.write(content) + return True + except OSError as e: + print(f"Error appending to file {filepath}: {e}") + return False + +# Example usage of append: +if append_to_file(filepath, "\nand more yooo"): # \n for a new line + print("Successfully appended to the file.") +else: + print("File append operation failed.") diff --git a/sdf b/sdf new file mode 100644 index 0000000..e69de29