Hi,
I am nearly ready for the new season on the Heritage railway I volunteer
on and I am putting the final touches to a revamped 'runaway train'
attraction in the museum. The last act is to get the code to auto-start
on power up, and I thought that I would use 'systemd'.
The code runs on a Raspberry Pi;
via the GPIO: sensing an input, reed switch, and controlling three
outputs; smoke machine, fan and vibrating floor.
on activation a video is played, at 8 times real speed, which is
viewed through a mock-up of a loco cab.
I can run a program using:
[Unit]
Description=TestVideo Service
After=multi-user.target
[Service]
Type=idle
User=pi
ExecStart=/bin/bash /home/pi/Code/testVideo.sh
Restart=no
RestartSec=0
[Install]
WantedBy=multi-user.target
where 'testVideo.sh'
## Dave Hill, 28/02/2019
# 2 = HDMI, 1 = headphones, 0 = Auto
amixer cset numid=3 1
python3 /home/pi/Code/TestVideo#6.py CLIP0026.MP4 20 DEBUG
exit 0
as I want to control the audio output, in this case direct audio to the
Raspberry Pi stereo output.
The program runs an infinite loop that can be exited by Cntrl-C
I would like to take advantage of the 'restart' functionality, but I
still wish to have a method of exiting
i.e. Restart=always
Is there a way in which I can have automatic restart but also have a way
of exiting?
Thanks in advance,
Dave
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor