-
Notifications
You must be signed in to change notification settings - Fork 0
/
shutdown.py
32 lines (27 loc) · 861 Bytes
/
shutdown.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
def main():
choice = input("select operation type?(shutdown/restart)")
if choice == "shutdown" or choice == "shutdown":
shutdown()
elif choice == "restart" or choice == "Restart":
restart()
else:
print("wrong choice please try again .")
main()
def shutdown():
shutdown = input("do you want to shutdown system(yes/no)?")
if shutdown == "yes" or shutdown == "Yes" :
os.system("shutdown /s /t 1")
os.system("sudo poweroff")
os.system("shutdown now -h")
elif shutdown == "no":
exit()
def restart():
restart = input("do you want restart system(yes/no)")
if restart == "yes" or restart == "Yes" :
os.system("sudo reboot")
os.system("shutdown /r")
os.system("shutdown -r -t 0")
elif restart == "no" :
exit()
main()