Files

51 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""System information utility - quick environment snapshot."""
import os
import platform
import sys
from datetime import datetime, timezone
from pathlib import Path
def get_system_info():
"""Collect basic system information."""
info = {
"timestamp": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"),
"hostname": platform.node(),
"os": platform.system(),
"os_version": platform.version(),
"architecture": platform.machine(),
"python_version": platform.python_version(),
"python_executable": sys.executable,
"cwd": os.getcwd(),
"user": os.environ.get("USER", "unknown"),
"home": str(Path.home()),
"env_vars": {
"SHELL": os.environ.get("SHELL", "none"),
"LANG": os.environ.get("LANG", "none"),
"PWD": os.environ.get("PWD", "none"),
}
}
return info
def main():
info = get_system_info()
output_path = Path("/root/.hermes/wizard-outputs/spark/sysinfo_output.txt")
with open(output_path, "w") as f:
f.write("=== System Information Snapshot ===\n\n")
for key, value in info.items():
if isinstance(value, dict):
f.write(f"{key}:\n")
for k, v in value.items():
f.write(f" {k}: {v}\n")
else:
f.write(f"{key}: {value}\n")
print(f"System info saved to: {output_path}")
print(f"Hostname: {info['hostname']}")
print(f"OS: {info['os']} {info['architecture']}")
print(f"Python: {info['python_version']}")
if __name__ == "__main__":
main()