You can use command blocks proximity detector command. Just stuff the command blocks away. Here is a example: <pre>-=redstone |-|=powered rail c= command block c----|-|</pre>