Rc.local not running at boot

I have the following in my /etc/rc.local file, but the mount doesn’t run on boot, but does if I run it manually.

#!/bin/sh -e
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

rclone mount Dropbox: /Dropbox --allow-other --daemon

exit 0

I have made the file executable.

System Info:-

Hostname OpenWrt
Model Raspberry Pi Compute Module 4 Rev 1.0
Architecture ARMv8 Processor rev 3
Target Platform bcm27xx/bcm2711
Firmware Version OpenWrt 22.03.3 r20028-43d71ad93e / LuCI openwrt-22.03 branch git-23.119.80898-65ef406
Kernel Version 5.10.161

How do I get rc.local to run?

Thanks for any help and advice.

it is possible that rc.local is attempting to execute this prior to the actual completion of the boot cycle and network coming up. rc.local is the last process to be started, but it is not necessarily the last one to be completed. Obviously, the network would be required for this to run.

Try putting in a sleep -- maybe 30 seconds.

2 Likes

I had tried that as well, but it still didn’t run unfortunately.

How about putting this line of code into a separate script file, and add a logger statement. Test the script file and make sure it works... then add that script file to the rc.local and see what the log says.

1 Like

Is there a reason the strong #!/bin/sh -e has been added?

No need.

I assume you installed this package, correct?

So rc.local is running. I removed the rclone mount command and added /rooot/mount.sh which contains the rclone Dropbox mount command. This still doesn't mount on boot, but does manually. Logging rclone reveals that it can't find the rclone conf file, but does when run manually. What's going on???!!! Thanks!

You need to pass the --config option to rclone so it knows where to find the config file when it's not launched from the pwd.

1 Like

Notice that it looks for the file on "/.config/rclone" when run from "rc.local", but on "/root/.config/rclone" when run from the command line. Your script is looking for the config file in the "current" directory, and that is a bug; do "cd /", then launch the script, and see it fail. You must use full paths, or proper search paths.

1 Like

Thank you both. Adding the —config path resolved the issue.

Thanks again!!

1 Like