#!/usr/bin/env python3 import os import sys import subprocess def main(script_path, output_path): try: # Make the script executable os.chmod(script_path, 0o755) # Execute the script and redirect output with open(output_path, 'w') as output_file: result = subprocess.run([script_path], stdout=output_file, stderr=subprocess.STDOUT) # Exit with the script's return code sys.exit(result.returncode) except Exception as e: print(f"Error: {e}") sys.exit(1) if __name__ == "__main__": if len(sys.argv) != 3: print("Usage: python ConsolaRemota.py ") sys.exit(1) script_path = sys.argv[1] output_path = sys.argv[2] main(script_path, output_path)