This is not strictly a Python issue, but it's the nearest category to find the problem - that I could find.
However python is very much involved.
I have a cron schedule running a light and sound show system at a military museum.
Seemingly at random, it will simply fail to fire one or more events.
events that have been tested thoroughly and have fired many times in the past without alteration.
I tested each line manually, and everything works.
Today, at 11:40 I noticed that events have failed to fire, and failed to do so for the following 10 minutes, until I manually initiated one of the commands (gramaphone.py)
After which time, everything seems to be happening normally.
some of my scripts disable cron and restart it, so I checked "sudo service cron status" and it reported that it was indeed running.
All code is done via root cron.
Cron and code samples below:
Root Cron schedule:
Code: Select all
##########CUSTOM CRON FOR GIPPSLAND ARMED FORCES MUSEUM LIGHT AND SOUND SHOW#####
SYNCHRONIZED_LIGHTS_HOME=/home/pi/lightshowpi
#################load shutdown and reboot scripts##########################
@reboot python /home/pi/shutdown.py >/dev/null 2>&1
@reboot python /home/pi/reboot.py >/dev/null 2>&1
#################load the clock############################################
@reboot sh /home/pi/loadclock.sh
################ Load everything else #####################################
00 10 * * * python /home/pi/indiansummer.py >/dev/null 2>&1
04 10 * * * python /home/pi/blue.py >/dev/null 2>&1
07 10 * * * python /home/pi/tuxedo.py >/dev/null 2>&1
10 10 * * * python /home/pi/resetrelays.py
############10 minutes before start########
10 10 * * * sh /home/pi/AA.sh >/dev/null 2>&1
14 10 * * * sh /home/pi/americansWWII.sh >/dev/null 2>&1
18 10 * * * python /home/pi/blues.py >/dev/null 2>&1
22 10 * * * python /home/pi/chatanooga.py >/dev/null 2>&1
25 10 * * * python /home/pi/track16.py >/dev/null 2>&1
30 10 * * * mpg321 -g 100 /home/pi/AAbass.mp3 >/dev/null 2>&1###################################
31 10 * * * python /home/pi/track17.py >/dev/null 2>&1
35 10 * * * python /home/pi/track8.py >/dev/null 2>&1
40 10 * * * python /home/pi/gramaphone.py >/dev/null 2>&1
45 10 * * * mpg321 -g 80 /home/pi/p51flyby.mp3 >/dev/null 2>&1
46 10 * * * sh /home/pi/AA.sh >/dev/null 2>&1
50 10 * * * sh /home/pi/AA.sh >/dev/null 2>&1
55 10 * * * sh /home/pi/AA.sh >/dev/null 2>&1
59 10 * * * mpg321 -g 80 /home/pi/p51flyby2 >/dev/null 2>&1
00 11 * * * python /home/pi/bluey.py >/dev/null 2>&1 ########new########
12 11 * * * python /home/pi/7th.py >/dev/null 2>&1################not working!!!###############
16 11 * * * mpg321 -g 80 /home/pi/p51flyby3.mp3 >/dev/null 2>&1
17 11 * * * python /home/pi/track15.py >/dev/null 2>&1
21 11 * * * sh /home/pi/AA.sh >/dev/null 2>&1
26 11 * * * python /home/pi/gramaphone.py >/dev/null 2>&1
31 11 * * * mpg321 -g 80 /home/pi/b24landing.mp3 >/dev/null 2>&1
32 11 * * * sh /home/pi/AA.sh >/dev/null 2>&1
36 11 * * * python /home/pi/endwar.py >/dev/null 2>&1
43 11 * * * mpg321 -g 60 /home/pi/AA35mm1.mp3 >/dev/null 2>&1
44 11 * * * python /home/pi/japan.py >/dev/null 2>&1#########9 min###########
55 11 * * * sh /home/pi/AA.sh >/dev/null 2>&1
01 12 * * * python /home/pi/churchill.py >/dev/null 2>&1
19 12 * * * mpg321 -g 60 /home/pi/M113passby.mp3 >/dev/null 2>&1
20 12 * * * sh /home/pi/AA.sh >/dev/null 2>&1
30 12 * * * mpg321 -g 60 /home/pi/M1A1passby.mp3 >/dev/null 2>&1
32 12 * * * sh /home/pi/AA.sh >/dev/null 2>&1
37 12 * * * sh /home/pi/AA.sh >/dev/null 2>&1
41 12 * * * sh /home/pi/AA.sh >/dev/null 2>&1
45 12 * * * mpg321 -g 60 /home/pi/shermanpassby.mp3 >/dev/null 2>&1
49 12 * * * python /home/pi/gramaphone.py >/dev/null 2>&1
52 12 * * * python /home/pi/japan.py >/dev/null 2>&1###################9 min - replace me with something new
0 13 * * * sh /home/pi/americansWWII.sh >/dev/null 2>&1#########should no longer overlap - but remember to check###########
15 13 * * * python /home/pi/menzies.py >/dev/null 2>&1
30 13 * * * python /home/pi/shelter.py
32 13 * * * mpg321 -g 30 /home/pi/march4.mp3 >/dev/null 2>&1
33 13 * * * sh /home/pi/AA.sh >/dev/null 2>&1
34 13 * * * mpg321 -g 60 /home/pi/M1A1passby3.mp3 >/dev/null 2>&1
35 13 * * * sh /home/pi/AA.sh >/dev/null 2>&1
36 13 * * * mpg321 -g 50 /home/pi/desielturbopassby.mp3 >/dev/null 2>&1
38 13 * * * mpg321 -g 45 /home/pi/APCM2run.mp3 >/dev/null 2>&1
40 13 * * * sh /home/pi/AA.sh >/dev/null 2>&1
40 13 * * * mpg321 -g 60 /home/pi/b17.mp3 >/dev/null 2>&1
43 13 * * * sh /home/pi/105.sh >/dev/null 2>&1
44 13 * * * sh /home/pi/AA.sh >/dev/null 2>&1
45 13 * * * mpg321 -g 60 /home/pi/m60tank.mp3 >/dev/null 2>&1
55 13 * * * sh /home/pi/AA.sh >/dev/null 2>&1
0 14 * * * mpg321 -g 80 /home/pi/p51flyby.mp3 >/dev/null 2>&1
01 14 * * * python /home/pi/tuxedo.py >/dev/null 2>&1
5 14 * * * sh /home/pi/AA.sh >/dev/null 2>&1
10 14 * * * mpg321 -g 40 /home/pi/winjeelpass2.mp3 >/dev/null 2>&1
15 14 * * * mpg321 -g 40 /home/pi/march3.mp3 >/dev/null 2>&1
17 14 * * * sh /home/pi/AA.sh >/dev/null 2>&1
20 14 * * * sh /home/pi/40mm.sh >/dev/null 2>&1
21 14 * * * python /home/pi/blue.py >/dev/null 2>&1
25 14 * * * python /home/pi/menzies.py >/dev/null 2>&1########## Replace with something new########
41 14 * * * mpg321 -g 80 /home/pi/b24flyby.mp3 >/dev/null 2>&1
42 14 * * * mpg321 -g 80 /home/pi/p51flyby.mp3 >/dev/null 2>&1
43 14 * * * sh /home/pi/105.sh >/dev/null 2>&1
44 14 * * * mpg321 -g 40 /home/pi/march3.mp3 >/dev/null 2>&1
45 14 * * * mpg321 -g 40 /home/pi/p51flyby.mp3 >/dev/null 2>&1
46 14 * * * sh /home/pi/AA.sh >/dev/null 2>&1
48 14 * * * mpg321 -g 30 /home/pi/m60tank.mp3 >/dev/null 2>&1
50 14 * * * sh /home/pi/AA.sh >/dev/null 2>&1
55 14 * * * python /home/pi/7th.py >/dev/null 2>&1
03 15 * * * sh /home/pi/AA.sh >/dev/null 2>&1
10 15 * * * python /home/pi/blue.py >/dev/null 2>&1
14 15 * * * python /home/pi/japan1945.py >/dev/null 2>&1################replace with something new#####
20 15 * * * python /home/pi/AA.py >/dev/null 2>&1
24 15 * * * python /home/pi/blues.py >/dev/null 2>&1
######################## Shutdown scriptis ####################################
32 15 * * * sh /home/pi/endofday.sh >/dev/null 2>&1
0 17 * * * /sbin/shutdown -h now >/dev/null 2>&1
######################## bugle calls ##########################################
@reboot sh /home/pi/bootup.sh >/dev/null 2>&1
0 12 * * * mpg321 -g 80 /home/pi/reveille.mp3 >/dev/null 2>&1
30 15 * * * mpg321 -g 80 /home/pi/last_post.mp3 >/dev/null 2>&1
30 15 * * * rm /home/pi/detect.sh
######################## End bugle calls ######################################
######################## SPECIAL EVENTS ######################################
#Remembereance Day####
0 11 31 10 * sh /home/pi/111111/111111.sh >/dev/null 2>&1
0 11 1 11 * sh /home/pi/111111/111111.sh >/dev/null 2>&1
0 11 2 11 * sh /home/pi/111111/111111.sh >/dev/null 2>&1
0 11 11 11 * sh /home/pi/111111/111111.sh >/dev/null 2>&1
0 11 14 11 * sh /home/pi/111111/111111.sh >/dev/null 2>&1
0 11 15 11 * sh /home/pi/111111/111111.sh >/dev/null 2>&1
0 11 16 11 * sh /home/pi/111111/111111.sh >/dev/null 2>&1
#End Rememberance Day####
######################## END SPECIAL EVENTS ######################################
gramaphone.py:
Code: Select all
import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(25, GPIO.OUT)
#
#
#
#time.sleep(10)
GPIO.output(25, False)
os.system("mpg321 -g 20 /home/pi/gramaphone.mp3")
GPIO.output(25, True)
Code: Select all
sudo pkill -sigstop mpg321
#sudo service cron stop
#sudo mpg321 -g 50 /home/pi/chimeup.mp3
#sudo mpg321 -g 50 /home/pi/p51approaching.mp3
#sudo mpg321 -g 100 /home/pi/p51flyby.mp3
sudo python /home/pi/resetrelays.py
sudo /usr/bin/python /home/pi/lightshowpi/py/synchronized_lights.py --file=/home/pi/distantAAjets.mp3
#sudo python /home/pi/lightson.py
#sudo service cron start
sudo python /home/pi/resetrelays.py
Code: Select all
import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
GPIO.setup(23, GPIO.OUT)
GPIO.setup(24, GPIO.OUT)
GPIO.setup(25, GPIO.OUT)
time.sleep(5)
GPIO.output(18, True)
GPIO.output(23, True)
GPIO.output(24, True)
GPIO.output(25, True)