Skip to content

Commit

Permalink
Added option 5 to the menu (#7)
Browse files Browse the repository at this point in the history
Added option 5 to the menu
  • Loading branch information
nadersip authored Dec 12, 2024
2 parents 53c568a + f6a96c5 commit a4d9d28
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
14 changes: 14 additions & 0 deletions ProcessusMgm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#Option 1 : Afficher les processus
#Option 2 : Arrêter un processus
#Option 3 : Quitter

import os

def affiche_processus():
print("Voici les processus qui sont en cours: ")
processus = os.system("ps")
print(processus)

def stop_processus():
ps = input("Veuillez entrer le numero du processus a terminer: ")
stop = os.system("kill -9 " + ps)
16 changes: 12 additions & 4 deletions menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from GestionService import service_start
from GestionService import service_stop
from GestionService import service_restart
from ProcessusMgm import affiche_processus
from ProcessusMgm import stop_processus


print("############################################################")
Expand Down Expand Up @@ -120,9 +122,15 @@
print("Option 1 : Afficher les processus")
print("Option 2 : Arrêter un processus")
print("Option 3 : Quitter")

elif option == "6":
print("Quitter")

subOption = input("Veuillez sélectionner l'une des options: ")
if subOption == "1":
affiche_processus()
elif subOption == "2":
affiche_processus()
stop_processus()
elif subOption == "3":
print("Quitter")
else:
print ("Option invalide")
else :
print("Option invalide")

0 comments on commit a4d9d28

Please sign in to comment.