henribusio
Posts: 4
Joined: Mon Nov 04, 2019 10:22 am

automatic startup Bash script

Mon Nov 04, 2019 10:29 am

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?

Kendek
Posts: 128
Joined: Thu Jul 25, 2019 4:39 pm
Location: Kaposvár, Hungary

Re: automatic startup Bash script

Mon Nov 04, 2019 11:47 am

What happens if you try to execute the /etc/rc.local?

Code: Select all

sudo /etc/rc.local

henribusio
Posts: 4
Joined: Mon Nov 04, 2019 10:22 am

Re: automatic startup Bash script

Mon Nov 04, 2019 12:37 pm

i found a solution adding it to sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

Kendek
Posts: 128
Joined: Thu Jul 25, 2019 4:39 pm
Location: Kaposvár, Hungary

Re: automatic startup Bash script

Mon Nov 04, 2019 12:47 pm

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.

henribusio
Posts: 4
Joined: Mon Nov 04, 2019 10:22 am

Re: automatic startup Bash script

Mon Nov 04, 2019 12:51 pm

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

henribusio
Posts: 4
Joined: Mon Nov 04, 2019 10:22 am

Re: automatic startup Bash script

Mon Nov 04, 2019 12:51 pm

thank you all for helping :D

Kendek
Posts: 128
Joined: Thu Jul 25, 2019 4:39 pm
Location: Kaposvár, Hungary

Re: automatic startup Bash script

Mon Nov 04, 2019 12:54 pm

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

Return to “Advanced users”