I have a script I want to run on startup (this is for a raspberry pi), and I've followed the instructions in the answer to the same question (linked here).
The code I want to run is in a text file called
startup.sh#!/bin/shis in the first line ofstartup.sh. But when I runsudo startup.shin the terminal to check whether the code is functioning, I get an error that says, "command not found". I get the same error when I runstartup.shIn
/etc/rc.local, I've writtensh, then the full pathname tostartup.shfollowed byexit 0sh /home/bugs/Desktop/AutoBeetle-BeetleMonitoring/startup.shexit 0
verified that the first line in
/etc/rc.localis#!/bin/sh -eensured
/etc/rc.localis executable:sudo chown root /etc/rc.local sudo chmod 755 /etc/rc.localverified that the code works:
sudo /etc/rc.local start
When I do this, the code works perfectly. But when I re-boot the system, it still doesn't run on startup. I'm confused why everything works except step 2, and whether that's causing the problems with running on startup. Any help much appreciated.