-1

I am really struggling to get my pi to autorun a bash script on startup.

A little background - it is running Raspbian, it has LXDE, and it is set to autologin as the "pi" user in raspi-config.

I have followed about 6 different "how to" guides, and not one of them has worked for me! LXDE also has a "Desktop Session Settings" menu option, and I have also tried adding it to the Autostart section in there and still no joy. Tbh I'm not sure I'm adding the right thing here though - I have tried

@bash /home/pi/script.sh 

and then tried all kinds of things like

/bin/sh /home/pi/script.sh

/home/pi/script.sh

/bin/bash /home/pi/script.sh

to no avail. I have tried adding it to both the "pi" user and root crontabs and have added the PATH= and SHELL= options suggested as fixes. I wondered if the problem was that I created the script as root, so I re-created it as the pi user and did everything over again.

I have also tried following all the suggestions for adding to /etc/xdg/LXDE/autostart and /etc/init.d/

0

Erk,

Totally figured this out just after posting - I tried running the script from the LXTerminal instead of root and got an error "could not open history database" meaning - I'm guessing, the pi user couldn't run the script without error. I added the word "sudo" in front of the epiphany line in the script and it works This may help someone else though!

  • Searching around briefly implies to me that this "history database" is in the user's home directory (it is from epiphany). If you get the same error when trying to start epiphany under any circumstances then somehow the ownership has gotten changed, and probably you want to fix that. Running a web browser as root or via sudo is a very serious security risk. The software certainly isn't intended to force you to do that. – goldilocks Jul 6 '16 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.