Filter out events <p>I have a TellstickDuo, a small device capable of sending signals to my lamps at home to turn them on or off based on a schedule. This device sends around 3-5 "on-signals" and "off-signals" every time i press the remote control button (to make sure at least one signal is sent correctly i guess!?). I also have a Raspberry Pi that listens for these signals and starts a script when a specific signal is found (based on the lamp-devices id´s).</p> <p>The problem is that everytime when it sends 3-5 signals my script runs the same amount of times but i only want it to run once. Is there any way to capture these signals and with bash (.sh) ignore everyone but one ?</p> <p>Code sent from device:</p> <pre><code>...RUNNING /usr/bin/php /var/www/autosys/python_to_raw.php "class:command;protocol:arctech;model:selflearning;house:13741542;unit:10;group:0;method:turnon;" ...RUNNING /usr/bin/php /var/www/autosys/python_to_raw.php "class:command;protocol:arctech;model:selflearning;house:13741542;unit:10;group:0;method:turnon;" ...RUNNING /usr/bin/php /var/www/autosys/python_to_raw.php "class:command;protocol:arctech;model:selflearning;house:13741542;unit:10;group:0;method:turnon;" ...RUNNING /usr/bin/php /var/www/autosys/python_to_raw.php "class:command;protocol:arctech;model:selflearning;house:13741542;unit:10;group:0;method:turnon;" </code></pre> <p>and my script is:</p> <pre><code>#!/bin/bash if [[ ( "${RAWDATA}" == *13741542* ) &amp;&amp; ( "${RAWDATA}" == *turnon* ) ]]; then # Something will be done here, like turn on a lamp, send an email or something else fi </code></pre> <p>(Some explanation to the RAWDATA code can be found here: <a href="http://developer.telldus.com/blog/2012/11/new-ways-to-script-execution-from-signals" rel="nofollow">http://developer.telldus.com/blog/2012/11/new-ways-to-script-execution-from-signals</a>)</p> <p>If i set my bash-script to send an email i get 4 emails, if i set it to update a counter at my local webpage it updates it 4 times. There is no way to controll how many signals the device will send, but can i only capture it once somehow? Maybe some way to "run script on first signal and drop everything else for 5 seconds"</p>