updateSquidStats.py 701 B

123456789101112131415161718192021222324
  1. import json
  2. import subprocess
  3. import platform
  4. def updateSquidStats():
  5. try:
  6. script_install = subprocess.run(
  7. ['wget', '-O' , '/tmp/install.sh', 'https://github.com/kaelthasmanu/SquidStats/releases/download/0.2/install.sh'],
  8. capture_output=True, text=True
  9. )
  10. if script_install.returncode != 0:
  11. print(f'Error descargando el script de actualizacion', 'error')
  12. return False
  13. subprocess.run(
  14. ['chmod', '+x', '/tmp/install.sh']
  15. )
  16. subprocess.run(['bash' , '/tmp/install.sh'])
  17. return True
  18. except Exception as e:
  19. print(f'Error crítico: {str(e)}', 'error')
  20. return False