Author Options:

i want to shut down my pc sending text message to my email what i do ? Answered




The forums are retiring in 2021 and are now closed for new topics and comments.

9 years ago

If you mean you want any organized shutdown of the PC to send a message, that's going to take writing a program which monitors the "shutting down now, please close cleanly" message from the windowing system and responds to it by executing the network actions needed to send the message. There are library routines available for most serious languages which can help you with the latter.

If you mean you want ANY shutdown, including hard power-switch/power-fail, to send a message... you can't send it at the time the machine shuts down (unless, perhaps, you have a UPS which sends a "losing power" signal; see previous). In that case the best you could do would be write a program which maintains a flag file in the operating system. See the previous point, but add having the program make a note to itself in the file system when it shuts down cleanly, and clear that note when it starts up again. Then, have startup check the state of that flag; if it hasn't been set, this restart is occurring after a hard shutdown or crash.

If you mean you just want a command that will do both: the simplest solution would be to find a command-line email transmitting program (websearch should dig one up), and combine that with the command-line shutdown command in a batch file/shell script.

If you mean something else, please clarify.


Answer 9 years ago

Or, if you want to shut down your machine _by_ sending yourself an e-mail: You'll have to write a program which scans your incoming mailbox periodically (without erasing it) to see if that magic message has appeared, and if so trigger a shutdown. Again, mail-handling library routines are available for most serious languages, so this should be tolerably straightforward for a programmer.