0

i needed 50+ rp points to comment on this one:

Run bash script on startup

my "problem" is that i use adafruits read only script: https://github.com/adafruit/Raspberry-Pi-Installer-Scripts/blob/master/read-only-fs.sh

on line 264-266 i can see that prevents me from making changes to crontabs even if i go in write mode

but i can go in write mode ('sudo mount -o remount,rw /) and make the crontabs i need and copy them to /home/pi and they stay there even after reboots, i have even made a bash script that copies them back to /var/spool/cron/crontabs

i works fine if i login with ssh and run the script.

i then copied the script to /etc/init.d/ (in write mode of course) and ran sudo update-rc.d nameofscript.sh defaults and just to double check i ran chmod +x /etc/init.d/nameofscript.sh

then i go to read-only ('sudo mount -o remount,ro /) and reboot

the script is not run, but if i go to /etc/init.d/ and run the script manual it works fine

could there be changes since jessie to stretch that needs a different way to make it run?

  • "i then copied the script to /etc/init.d/...: -> There is a note on that question, added a year ago, indicating "The accepted answer here should be considered obsolete". I've added this to that answer as well to make it clearer. – goldilocks Nov 09 '18 at 14:11

1 Answers1

1

i took the 2 lines from my script and added them to /etc/rc.local before the final exit

might not be the right way but it gets the job done