1

I want to run this working .sh file when I boot into the LXDE (preferably when it is completely loaded):

mkdir /tmp/stream &

raspistill --nopreview -w 1024 -h 768 -q 70 -o /tmp/stream/pic.jpg -tl 100 -sh 100 -vs -t 9999999 -th 0:0:0 &

LD_LIBRARY_PATH=/usr/local/lib mjpg_streamer -i "input_file.so -f /tmp/stream -n pic.jpg" -o "output_http.so -w /usr/local/www" &

forever /home/pi/tank/index.js

Last attempt, I tried to use the instructions in this thread, resulting in a disaster.. had to reinstall completely.

Will my script run if I just add the following to my .bashrc file?

/home/pi/tank/tank.sh

I really want to make sure before I try this..

Thanks in advance

Maarten Hartman
  • 247
  • 1
  • 3
  • 12

2 Answers2

5

Ok, fixed it with the instructions below. I add this answer because this is quite specific (run when desktop is loaded).

open up the file using nano:

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


add the following line to the bottom of the file (just as last line)

@sh /home/pi/myproject/myscript.sh


save and reboot!
Maarten Hartman
  • 247
  • 1
  • 3
  • 12
0

You could put the call to your script in /etc/rc.local Make sure you run it in the background ( so add & at the end of your call ). The calls in rc.local will be run when the pi boots at the end of the boot process. Please note, your script will not have access to the screen or the keyboard when run from rc.local. This may not be a problem, although I'm not sure what the final line 'forever index.js' does.

jos
  • 46
  • 1
  • The request was to wait until after the LXDE environment is loaded before running the script. rc.local is a system script that runs at the end of each multi-user run-level & is the last thing to be run as the system boots. It however, is in no way dependent upon or will it wait for the user to log in to the system through the login manager, and cannot know when the LXDE session has loaded completely. – colpanic73 Jul 02 '22 at 12:10