Reply To: Raspian rc.local pianobar
Any time something runs while logged in but not from system scripts like /etc/rc.local, the most likely culprit is environment. HOME is probably the environment variable which is used to locate those credentials. If it weren’t set to /home/pi for example, it’d probably never find them. Another common one is if it’s a graphical program, it will not have access to :0 and indeed will not have DISPLAY set to even find :0.
I’d also say, if you’re going to start up stuff from rc.local or /etc/init.d/scripthere, it’d be an exceptionally good idea not to run as the superuser, so you could prefix the running of something with sudo -H pi somecommand or perhaps su – pi -c ‘somecommand with args’