I have a small Python script that I need to run headless. It's function is to sound the bells at fixed times of the day (eg, church chimes in a model town) and also to play music and other sounds to order. The chimes are triggered by function calls in apscheduler entries and the music and other sounds are triggered using RPi.GPIO.add_event_detect() entries, where the events are triggered by the user depressing a switch.
This all works perfectly in IDLE. The apscheduler and RPi.GPIO statements are all setup on startup and then the script sits there doing nothing until the user triggers an event or the time to ring the bells comes round. Afterwards the script idles until the next event. Very gratifying
The problem comes when I try to launch it from the shell on boot-up (or by direct invocation). The script runs OK, but it looks as though it then exits instead of idling as it does in IDLE (excuse the pun). Is this expected behaviour? If so, is there a way round it?