tailieunhanh - Apress - Smart Home Automation with Linux (2010)- P35

Apress - Smart Home Automation with Linux (2010)- P35:Linux users can now control their homes remotely! Are you a Linux user who has ever wanted to turn on the lights in your house, or open and close the curtains, while away on holiday? Want to be able to play the same music in every room, controlled from your laptop or mobile phone? Do you want to do these things without an expensive off-the-shelf kit | CHAPTER 5 COMMUNICATION In Chapter 7 you ll learn how to extend this functionality to support a basic address book and multiple receivers. Autoprocessing E-mails Accepting e-mails on behalf of a program instead of a human user can be summed up in one word Procmail was a project begun in 1990 by Stephen R. van den Berg to control the delivery of email messages and although some consider it a dead project this makes it a stable project and one that s unlikely to break or introduce new complications anytime soon Procmail is triggered by the e-mail server an MTA such as Exim by passing each message for further processing to each of a series of recipes. If none of these recipes lays claim to the message it is delivered as normal. I ll begin by creating a simple example whereby you can e-mail your bedroom light switch. So create a user with the following and fill in all the necessary user details adduser bedroom Then create a .procmailrc file note the dot in their home directory and add the following recipe code 0 AFrom steev ASubject light on heyu turn bedroom_light on This requires that the sender is steev4 5 and that the subject is light on before it runs the heyu command to control the light. Both conditions must be met. You can and should extend these arguments to include the full e-mail address to prevent any steev from having control over the light and perhaps a regular expression to make the subject line case insensitive. But before we continue I ll break down those elements. Each recipe consists of three parts Mode This is generally 0 but can also include instructions for locking so that the recipe cannot be run multiple times simultaneously by appending another colon with the name of a lock file for example 0 mylock . Conditions Zero or more lines beginning with an asterisk indicating how the email must appear for processing to occur. This also supports regular expressions. Since every condition must be satisfied in an AND logical fashion you can .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.