Startup rpi script

hi,
How i can run automatically in the background dht11 script @ rpi. i can manually run but automatic does not work.

my rc.local file;

#!/bin/sh -e

rc.local

This script is executed at the end of each multiuser runlevel.

Make sure that the script will “exit 0” on success or any other

value on error.

In order to enable or disable this script just change the execution

bits.

By default this script does nothing.

Print the IP address

_IP=$(hostname -I) || true
if [ “$_IP” ]; then
printf “My IP address is %s\n” “$_IP”
fi
sudo NODE_PATH=“/usr/local/lib/node_modules” node ./blynk-sensor-test.js --token=mytoken &

exit 0

please help me

@idjcondor try adding it to crontab with crontab -e and then add:

@reboot sh nameofscriptfile.sh

Try sh nameofscriptfile.sh at command prompt before adding it to crontab.

hi,
thanks your answer but the problem continue,

pi@raspberrypi:~ $ sudo sh blynk-sensor-test.sh
sh: 0: Can’t open blynk-sensor-test.sh

The script needs to be made executable with:

sudo chmod+x blynk-sensor-test.sh

then try this:
sh ./blynk-sensor-test.sh

chmod No such file or directory error… i’m trying four days

pi@raspberrypi:~ $ sudo chmod +x blynk-sensor-test.sh
chmod: blynk-sensor-test.sh''e erişilemedi: Böyle bir dosya ya da dizin yok pi@raspberrypi:~ $ sudo chmod +x blynk-sensor-test.js pi@raspberrypi:~ $ sudo chmod +x blynk-sensor-test.sh chmod: blynk-sensor-test.sh’'e erişilemedi: Böyle bir dosya ya da dizin yok
pi@raspberrypi:~ $ sh ./blynk-sensor-test.sh
sh: 0: Can’t open ./blynk-sensor-test.sh
pi@raspberrypi:~ $ sh ./blynk-sensor-test.js
./blynk-sensor-test.js: 1: ./blynk-sensor-test.js: Syntax error: “(” unexpected
pi@raspberrypi:~ $

You need to be in the same directory as the script file when you do the chmod.

Below is one of my script files that is located in the root directory, called pizero, without the sh suffix.

#!/bin/sh
#
cd ~/blynk-library/linux
sudo ./blynk --server=192.168.10.229 --token=xxxxxxxxxxxxxxxxx &

So from root directory

cd ~/blynk-library/linux
sudo chmod +x pizero

return to root directory where the script file is:

cd ~

test simply with:

sh pizero

Connection confirmed by Blynk.

Then:

crontab -e

and add:

@reboot sh pizero &

Let me know how you go with these details.