Reputation:
I've wrote a python script to check whether a condition has been fulfilled(in this case, the condition is a tweet).
Now, I want the computer to shutdown if the condition has been fulfilled. How do I use the result Python provides to invoke a shutdown
command in Ubuntu?
Upvotes: 1
Views: 1013
Reputation: 28982
You can write a simple bash script that checks the result of your python program, and uses the terminal command "shutdown -h now".
Upvotes: 0
Reputation: 64177
import os
if condition:
os.system("shutdown -h now")
Just make sure the user running the script has privileges to call shutdown.
Upvotes: 0