Demand response is a key feature of the smart grid. The addition of bidirectional communication to today's power grid can provide real-time pricing (RTP) to customers via smart meters. A growing number of appliance companies have started to design and produce smart appliances which embed intelligent control modules to implement residential demand response based on RTP. However, most of the current residential load scheduling schemes are centralized and based on either day-ahead pricing (DAP) or predicted price, which can deviate significantly from the RTP. In this paper, we propose an opportunistic scheduling scheme based on the optimal stopping rule as a real-time distributed scheduling algorithm for smart appliances' automation control. It determines the best time for appliances' operation to balance electricity bill reduction and inconvenience resulting from the operation delay. It is shown that our scheme is a distributed threshold policy when no constraint is considered. When a total power constraint exists, the proposed scheduling algorithm can be implemented in either a centralized or distributed fashion. Our scheme has low complexity and can be easily implemented. Simulation results validate proposed scheduling scheme shifts the operation to off-peak times and consequently leads to significant electricity bill saving with reasonable waiting time.