TringaliLuca

grabcard.sh

Jul 19th, 2019
127
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ### nano /home/pi/nfcmillionaire/grabcard.sh
  2. #!/bin/bash
  3.  
  4. outfolder="/var/www/html/files"
  5. execfile="/home/pi/nfcmillionaire/readcc"
  6.  
  7. while true; do
  8. outfile=$(date +%Y-%m-%d_%H-%M-%S)".txt"
  9. $execfile > $outfolder/$outfile
  10. num_of_lines=$(wc -l < "$outfolder/$outfile")
  11. echo $num_of_lines
  12. if [[ $num_of_lines -gt 3 ]]; then
  13. echo "Got it"
  14. else
  15. rm "$outfolder/$outfile"
  16. fi
  17. done
  18.  
  19.  
  20.  
  21. #### sudo nano /lib/systemd/system/grabcard.service
  22. [Unit]
  23. Description=Get credit card info automatically from NFC
  24.  
  25. [Service]
  26. #User=pi
  27. ExecStart=/home/pi/nfcmillionaire/grabcard.sh
  28. Type=simple
  29.  
  30. [Install]
  31. WantedBy=default.target
  32. Alias=grabcard.service
RAW Paste Data