Popular recipes tagged "shutdown" but not "reboot"http://code.activestate.com/recipes/tags/shutdown-reboot/2016-11-13T20:17:03-08:00ActiveState Code RecipesTrap KeyboardInterrupt and EOFError for graceful program termination (Python) 2016-11-13T20:17:03-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580718-trap-keyboardinterrupt-and-eoferror-for-graceful-p/ <p style="color: grey"> Python recipe 580718 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/error/">error</a>, <a href="/recipes/tags/exception/">exception</a>, <a href="/recipes/tags/handler/">handler</a>, <a href="/recipes/tags/shutdown/">shutdown</a>, <a href="/recipes/tags/terminate/">terminate</a>, <a href="/recipes/tags/utilities/">utilities</a>, <a href="/recipes/tags/utility/">utility</a>). </p> <p>This recipe shows how to trap the KeyboardInterrupt and EOFError Python exceptions so that they do not crash your program. As a vehicle to show this, it uses a small Python utility that shows the ASCII code for any ASCII character you type.</p> Shutdown your computer via E-mail - Python (Python) 2016-05-27T05:28:21-07:00Burak Tandoganhttp://code.activestate.com/recipes/users/4191373/http://code.activestate.com/recipes/580668-shutdown-your-computer-via-e-mail-python/ <p style="color: grey"> Python recipe 580668 by <a href="/recipes/users/4191373/">Burak Tandogan</a> (<a href="/recipes/tags/computer/">computer</a>, <a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/mail/">mail</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/shutdown/">shutdown</a>). Revision 2. </p> <p>Shutdown your computer via E-mail.</p> <p>Basically, send an e-mail to your e-mail address SHUTDOWN YOURSELF {YEAR-MONTH-DATE} format in Subject. Your mail's SUBJECT must be in SHUTDOWN YOURSELF {YEAR-MONTH-DATE} format.</p> Handle exit context manager (Python) 2014-08-01T08:28:07-07:00Giampaolo RodolĂ http://code.activestate.com/recipes/users/4178764/http://code.activestate.com/recipes/577997-handle-exit-context-manager/ <p style="color: grey"> Python recipe 577997 by <a href="/recipes/users/4178764/">Giampaolo RodolĂ </a> (<a href="/recipes/tags/atexit/">atexit</a>, <a href="/recipes/tags/contextlib/">contextlib</a>, <a href="/recipes/tags/contextmanager/">contextmanager</a>, <a href="/recipes/tags/exit/">exit</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/python3/">python3</a>, <a href="/recipes/tags/shutdown/">shutdown</a>, <a href="/recipes/tags/sigint/">sigint</a>, <a href="/recipes/tags/signal/">signal</a>, <a href="/recipes/tags/sigterm/">sigterm</a>). Revision 23. </p> <p>A context manager which properly handles SIGTERM (SystemExit) and SIGINT (KeyboardInterrupt) signals, registering a function which is always guaranteed to be called on interpreter exit. Also, it makes sure to execute previously registered functions as well (if any).</p>