Is there way to have Blynk Script run automatically with my token in RPi

I have the same problem here. I run my raspberry pi using a monitor and a keyboard. I had installed the blynk library. I jad followes the instruction and it says that your device is ready to use… and as I access with my blynk app it says that the device is online. but when I close the panel where I access the blynk library and whenever I reboot my device. The blynk app says that device is offline and I have to type the code and run the blynk library all over again.

Is there any other way that the blynk library in my raspberry pi automatically run with my token. whenever I turn on or reboot my device?

Don’t close it.

Yes several ways but take a look at

Thank you for that link it help alot. But I am new with the blynk and I am making a home automation with my raspberry pi to control 16 channel relay module. The easy way to set it up is using the blynk library. I have no idra on script writing. do have a script that I can use to control the gpio?

Thank you in advance.

The issue is not Blynk related, rather a Linux question.

it is admittedly a bit tricky, but there are a few ways of keeping a Linux script running after closing a CLI window as well as running a script automatically.

Take a look at the link @Costas provided,

hi actaully I have been using this method I have watch in youtube. but when i close this the device becomes offline so i need to redo the process with the token key.

Did you fork the process (what a funny term) by adding an ampersand ( & ) to the end of the command?

what do you mean. I follow what he did on the video. it actually works. I have my device online in the blynk app. but as I experience when I close it the device turns offline. so I have to repeat the part. ./blynk --token=… to make the devicr online again.

But my problem is I need to make it autimatically. when I turn on my raspberry it should automatically connect to the device.


For example, I use this in my rc.local to start my Local Server:

sudo java -jar /home/gunner/server-0.25.1.jar -dataFolder /home/gunner/Blynk &

guys please help me. how can I make this command automaticaly starts in raspberry pibterminal after reboot of my raspberry pi.

pi@raspberrypi:~ $ sudo /home/pi/blynk-library/linux/blynk --token=04a8

so I dont need to manually open my terminals ang execute this command. I want it to execute automaticaly.

Thank you in advance!

1 Like

i just wn to execute this comands in raspberry terminal automatically. so I canautomatically access my device through blynk app.

Seach for using rc.local to execute programs on startup. Or add them to crontab. Crontab has functions for executing stuff on startup, but the rc.local method would be the best way to achieve what you want.

1 Like

This OP has been given a link and multiple references on how to resolve his issue… but I don’t think he has even clicked on the link :disappointed:


Too right, not a single click on the link I provided :frowning:

thank you so much! This solved my problems all day …

I have the same pbs.
I added the “&” at the end of the command line in /etc/rc.local
“sudo NODE_PATH=/usr/local/lib/node_modules node /home/pi/blynk-sensor-test.js”
and when I run /etc/rc-local in console mode its ok, I can leave the ssh connection and blynk is still on line.
the pb is after reboot, blynk seems to don’t run (Offline since… in the app android).
I have this :
Error: Cannot find module ‘/home/pi/home/pi/blynk-sensor-test.js’
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
Can you help me. Thank you.

Ok now
I tried successfully cron

1 Like