Page 1 of 1

automatic startup Bash script

Posted: Mon Nov 04, 2019 10:29 am
by henribusio
Hi i made a bash script en when a mannualy click it it works but when i try to add it to RC.LOCAL its does not start activate with the system.


file exist in /home/pi/script

i went to /etc/rc.local and added the script just before the exit like this.

/home/pi/script

but it does not work.

Can some one help me?

Re: automatic startup Bash script

Posted: Mon Nov 04, 2019 11:47 am
by Kendek
What happens if you try to execute the /etc/rc.local?

Code: Select all

sudo /etc/rc.local

Re: automatic startup Bash script

Posted: Mon Nov 04, 2019 12:37 pm
by henribusio
i found a solution adding it to sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

Re: automatic startup Bash script

Posted: Mon Nov 04, 2019 12:47 pm
by Kendek
henribusio wrote:
Mon Nov 04, 2019 12:37 pm
i found a solution adding it to sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
The correct file is

~/.config/lxsession/LXDE-pi/autostart

if you want to execute a script from your home directory.

Re: automatic startup Bash script

Posted: Mon Nov 04, 2019 12:51 pm
by henribusio
well not for me because i get this error

bash: /home/pi/.config/lxsession/LXDE-pi/autostart: No such file or directory

however with this it did work

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

Re: automatic startup Bash script

Posted: Mon Nov 04, 2019 12:51 pm
by henribusio
thank you all for helping :D

Re: automatic startup Bash script

Posted: Mon Nov 04, 2019 12:54 pm
by Kendek
henribusio wrote:
Mon Nov 04, 2019 12:51 pm
bash: /home/pi/.config/lxsession/LXDE-pi/autostart: No such file or directory

Code: Select all

mkdir -p ~/.config/lxsession/LXDE-pi
touch ~/.config/lxsession/LXDE-pi/autostart
nano ~/.config/lxsession/LXDE-pi/autostart