Search code examples
pythonubuntushutdown

using result of a python script to invoke shutdown in terminal(ubuntu)


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?


Solution

  • os.system('shutdown -h now')
    

    ?