I use supervisor to run about 6 startup scripts. The services start fine. But I then noticed that the scripts that had to do with calling a wav sound file did not work.
checking the status of supervisor I see that all my scripts are running yet the wav scripts fail to launch.
Here's an example of one of the python scripts
#!/usr/bin/env python
# Example for RC timing reading for Raspberry Pi
# Must be used with GPIO 0.3.1a or later - earlier verions
# are not fast enough!
import RPi.GPIO as GPIO
import time
import os
from subprocess import Popen
DEBUG = 1
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
song_path = '/home/pi/alerts/buzzer_alert.wav'
# change it to desire duration in seconds
duration_time = 5
def RCtime(RCpin):
reading = 0
GPIO.setup(RCpin, GPIO.OUT)
GPIO.output(RCpin, GPIO.LOW)
time.sleep(0.1)
GPIO.setup(RCpin, GPIO.IN)
# This takes about 1 millisecond per loop cycle
while GPIO.input(RCpin) == GPIO.LOW:
reading += 1
return reading
def main():
global duration_time
global song_path
while True:
print(RCtime(27)) # Read RC timing using pin #17
if RCtime(27) > 2700:
print('Laser triped')
os.system('aplay -d {} {}'.format(duration_time, song_path))
time.sleep(5)
GPIO.cleanup()
if __name__ == '__main__':
main()