I need a command to run at reboot. This command is called script.sh
#!/bin/bash
ibeacon scan | /home/pi/test.py
This command pipes input to a python program I wrote called test.py.
#!/usr/bin/python
import fileinput
import socket
import requests
for line in fileinput.input():
   if line.startswith('UUID:'):
      line = line.strip()
      a = line.split(' ')[1]
      b = line.split(' ')[3]
      c = line.split(' ')[5]
      d = line.split(' ')[7]
      e = line.split(' ')[9]
      f = socket.gethostname()
      payload = {'uuid': a, 'major': b, 'minor': c, 'power': d, 'rssi': e, 'hubname': f}
      r = requests.get('http://httpbin.org/get', params=payload)
     # print(r.url)     ##Print the URL
   elif line.startswith('iBeacon'):
      print "Starting script..."
      continue
   else:
      print "Error: invalid input, closing..."
      break
The problem is the program is not running when I check the processes.The syslog file states that it started the command on reboot, but it is not running.
Aug 19 22:23:35 raspberrypibeacon /USR/SBIN/CRON[2089]: (root) CMD (/home/pi/script.sh > /dev/null 2>&1)
my crontab entry looks like this
@reboot /home/pi/script.sh > /dev/null 2>&1
Is the problem with cron or with my program? My program works fine when run from the command line, but not when executed by cron.
