mirror of
https://github.com/skylanix/MamieHenriette.git
synced 2026-02-06 06:40:35 +01:00
27 lines
585 B
Python
Executable File
27 lines
585 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
|
|
def check_process():
|
|
"""Vérifie si le processus Python principal est en cours d'exécution"""
|
|
try:
|
|
# Vérifier si un processus python est actif
|
|
result = subprocess.run(
|
|
["pgrep", "python"],
|
|
capture_output=True,
|
|
text=True
|
|
)
|
|
return result.returncode == 0
|
|
except Exception:
|
|
return False
|
|
|
|
def main():
|
|
if check_process():
|
|
sys.exit(0) # Succès
|
|
else:
|
|
sys.exit(1) # Échec
|
|
|
|
if __name__ == "__main__":
|
|
main() |