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

  • This question had to be posted in the unix.stackexchange.com forum, since it's not raspberry-specific – Kais Mar 19 at 15:45
4

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!
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.

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.