I want the camera on my pi (Rpi 3B+) to take a picture every time it boots up. I've read through several other questions of people trying to do similar things, but I haven't ever found the script that was used to successfully achieve it. This is the first script I've written, so I'm guessing that the problem is with the script, rather than the init.d setup as that part is pretty easy to follow
Here's what I have:
# /etc/init.d/startup.sh
### BEGIN INIT INFO
# Provides: startup.sh
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
raspistill --annotate 12 -o /home/pi/Pictures/Startup/Startup_`date +%d%m%Y_%H%M-%S`.jpg
- I saved this to /etc/init.d/startup.sh
- then used
sudo chmod +x startup.sh
to make it executable - Then
sudo update-rc.d startup.sh defaults
as I understand it, to register the script to run at startup.
(These instructions were pulled straight from the page I linked above. I don't at all have a thorough understanding of what they actually do. I'm just following the best directions I can find.)
I have tested the raspistill command that I used in the script, and I know that it does work, and saves a timestamped image to the designated folder. I can even run the script from the init.d folder (by double-clicking on it in the GUI) and it works from that location when I run it. One last thing to note here, is that it does ask me what I'd like to do when I double click it, giving the options: Execute, Execute in Terminal, Open, and Cancel. I don't know if that's relevant to my issue, but I want to get everything out there.
Can someone please help me figure out what I'm doing wrong? TIA!