rc.local file not working raspberry pi
bash, raspberry-pi
Solution
I assuming you're running Raspbian, which is pretty much Debian.
`rc.local` runs as root before login, so you don't need or want `sudo`; it may be causing an error, hence nothing happening.
User-level commands that run for any user when they log in (unlike rc.local, which runs before login) can be put into `/etc/bash.bashrc`. That may be more applicable to your situation, at least the second command.
Login commands for the pi user only can be put into `/home/pi/.bashrc`
Problem
This is the contents of my `/etc/rc.local` file. It is supposed to run on login on my raspberry pi, yet it just logs in in (as I'm using auto login) and then does nothing, i.e. it just sits there with `pi@raspberrypi ~$_` waiting for a command. I have no idea why it's not working nor any experience with bash scripts. It should mount a usb then run a file on said usb but it doesn't. ``` #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. sudo /bin/mount /dev/sda1 /media/robousb sudo python media/robousb/Robopython/usercode_old.py exit 0 ```