Advertisement
Guest User

Untitled

a guest
Sep 1st, 2016
4,281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.17 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #log location, specific a diff location and file name as desired
  4.  
  5. log=/jffs/etc/config/amazon-dash-dnsmasq.log
  6.  
  7. #Put your dash button MAC Address here. Letters should be in lower case!
  8. #If you have less than 5 dash buttons, delete unnecessary lines
  9.  
  10. DASH1=xx:xx:xx:xx:xx:xx
  11. DASH2=xx:xx:xx:xx:xx:xx
  12. DASH3=xx:xx:xx:xx:xx:xx
  13. DASH4=xx:xx:xx:xx:xx:xx
  14. DASH5=xx:xx:xx:xx:xx:xx
  15.  
  16. #This script is passed a parameter value of either 'add', 'del', or 'old'
  17. #We do not want to trigger any events when the device is disconnected or removed, only when its added or re-triggered
  18.  
  19. if [ $1 = "del" ]; then
  20. exit
  21. else
  22.  
  23.     elif [ $2 = $DASH1 -a $1 != 'del' ]; then
  24.  
  25. # Command to run when the button is hit
  26.         curl -k -X POST https://maker.ifttt.com/trigger/<YOUR_EVENT_#1>/with/key/<YOURKEY>
  27.         date>>$log
  28.         echo "DNSMASQ - Dash #1 found" >> $log
  29.         echo "Param1 = $1" >> $log
  30.         echo "Param2 = $2" >> $log
  31.  
  32.     elif [ $2 = $DASH2 -a $1 != 'del' ]; then
  33.  
  34. # Command to run when the button is hit
  35.         curl -k -X POST https://maker.ifttt.com/trigger/<YOUR_EVENT_#2>/with/key/<YOURKEY>
  36.         date>>$log
  37.         echo "DNSMASQ - Dash #2 found" >> $log
  38.         echo "Param1 = $1" >> $log
  39.         echo "Param2 = $2" >> $log
  40.  
  41.     elif [ $2 = $DASH3 -a $1 != 'del' ]; then
  42.  
  43. # Command to run when the button is hit
  44.         curl -k -X POST https://maker.ifttt.com/trigger/<YOUR_EVENT_#3>/with/key/<YOURKEY>
  45.         date>>$log
  46.         echo "DNSMASQ - DASH #3 found" >> $log
  47.         echo "Param1 = $1" >> $log
  48.         echo "Param2 = $2" >> $log
  49.  
  50.     elif [ $2 = $DASH4 -a $1 != 'del' ]; then
  51.  
  52. # Command to run when the button is hit
  53.         curl -k -X POST https://maker.ifttt.com/trigger/<YOUR_EVENT_#4>/with/key/<YOURKEY>
  54.         date>>$log
  55.         echo "DNSMASQ - DASH #4 found" >> $log
  56.         echo "Param1 = $1" >> $log
  57.         echo "Param2 = $2" >> $log
  58.  
  59.     elif [ $2 = $DASH5 -a $1 != 'del' ]; then
  60.  
  61. # Command to run when the button is hit
  62.         curl -k -X POST https://maker.ifttt.com/trigger/<YOUR_EVENT_#5>/with/key/<YOURKEY>
  63.         date>>$log
  64.         echo "DNSMASQ - DASH #5 found" >> $log
  65.         echo "Param1 = $1" >> $log
  66.         echo "Param2 = $2" >> $log
  67.  
  68. else
  69. exit
  70. fi
  71.  
  72. #kill any other processes that might exist
  73. killall -q amazon-dash-dnsmasq
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement