Local Blynk server runinng o VPS (Ubuntu) stops running after few hours

sorry i may not explained it properly , i mean more details about your VPS provider .

no vps is active all the time.

Assuming you meant VPS open ALL the time :wink:

Double check that… Blynk requires a constant, every few seconds, communication link between the Server, App and MCU… even if you are not “doing anything” with it… the heartbeat is still processing.

So is it possible to change the frequency of the hearthbeat ? :slight_smile: or what would be the solution if we need it keep running and we want MCUs to wake up only once per hour for two seconds?

To a small degree for a few more seconds with #define BLYNK_HEARTBEAT 20 in my sketch, and using Local Server only… I have one of my heavier process projects set to 20 seconds (as in the shown command)… but can’t honestly say I see the difference.

If you want to work with sleep mode, then that is a totally different thing. Search this forum for more info about that

Thank you very much. I will search for sleep mode. So Local server cannot serve as blynk cloud?

A server is a server, whether “cloud” based or “local”… you can even setup a Local Server acting as a Cloud Server for others outside of your network, etc.

Point is, advanced users can setup and have full control over a Local Server of their own, whereas the official Blynk Cloud servers are not under your control for such tweaking of heartbeat, and other settings.

Anyhow, back to your original issue… did you figure out if it is your VPS or Local Server that is causing the disconnections?

Aha, ok. But Local server cannot produce the app, can’t it?

yes the provider said that VPS is still alive, never sleeps and the connection remains constant. So it should be the Server, If they are saying truth.

Not sure you understand… Blynk consist of three “parts” the App, the Server and the Device(s)

The App runs on the Phone/Tablet/Emulator as the primary GUI and it ‘talks’ to the Server…

The Server (Local, Cloud, etc. - each one being totally independent of all others) generates and authorizes the User accounts/logins and stores their individual projects & energy, along with generating and controlling the Auth codes. It also acts as the communications hub between the App and the Devices…

The Devices (AKA MCU) are the workhorses that run the Blynk Library, the users scripts (AKA programs, firmware, etc), and handle the I/O with all the sensors and feedback.

So anyhow… If you setup a “LOCAL” server, then you create an account on it and direct your App and Devices to it’s IP (Local and or Public - depending on your setup)… Thus keeping the Server running 24/7/365 is well, important :stuck_out_tongue:

Normally this is just a matter if installing it on some Java capable device with full-time network/internet, sufficient CPU and bandwidth (not much needed there really) and internal memory for logging and projects, etc.

I am not entirely understanding what you have setup or why… I just have my Local Server running on an old Netbook loaded with Mint and port forwarded via my router for both LAN and WAN access… Been running for a year with minimal downtime for updates, etc.

Reading the thread, not really sure if the problem is server or app based, but rc.local (depending on your configuration) doesn’t restart processes that exits automatically. You might want to look at systemd on later Ubuntu systems. I’ve wrote a small how-to:

I have tried this but it looks the server did not start. how can I chceck if it is running? or why it is behaving like this?

Try looking in the docs for Blynk server… It’s all there! :face_with_monocle:



EDIT:

Did you mean you tried systemd? If so, read the how-to I linked to.

Question, do you mean VPN (Virtual Private Network) or VPS (Virtual Private Server)?

  • Which version of Ubuntu do you use?

  • How does your start-up script looks like?

  • Have you looked in Ubuntus log files?

Yes, I have tried systemd. I went trough how to, did not skip any step.

Tried status?

Yes Virtual Private Server, (VPS) As I have been asked for. we have no need for vpn.

4.4.0-104-generic #127-Ubuntu SMP Mon Dec 11 12:16:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

[Unit]
Description=Starts and stops the Blynk server daemon

[Service]
WorkingDirectory=/home/blynk
#User=blynk
#Group=blynk
Restart=on-failure
RestartSec=10
ExecStart=/usr/bin/java -jar /home/Blynk/server-0.29.2.jar -dataFolder /home/Blynk

#-serverConfig /home/Blynk/server.properties

[Install]
WantedBy=multi-user.target

When you run ~# service blynk status (or what you named the service) it doesn’t complain? Try
~# journalctl -u blynk.service -b

Paths are case sensitive!

1 Like

Jan 03 19:30:16 mozogula systemd[1]: Started Starts and stops the Blynk server daemon.
Jan 03 19:30:16 mozogula systemd[1]: blynk.service: Main process exited, code=exited, status=200/CHDIR
Jan 03 19:30:16 mozogula systemd[1]: blynk.service: Unit entered failed state.
Jan 03 19:30:16 mozogula systemd[1]: blynk.service: Failed with result ‘exit-code’.
Jan 03 19:30:26 mozogula systemd[1]: blynk.service: Service hold-off time over, scheduling restart.
Jan 03 19:30:26 mozogula systemd[1]: Stopped Starts and stops the Blynk server daemon.
Jan 03 19:30:26 mozogula systemd[1]: Started Starts and stops the Blynk server daemon.
Jan 03 19:30:26 mozogula systemd[1]: blynk.service: Main process exited, code=exited, status=200/CHDIR
Jan 03 19:30:26 mozogula systemd[1]: blynk.service: Unit entered failed state.
Jan 03 19:30:26 mozogula systemd[1]: blynk.service: Failed with result ‘exit-code’.

and it continues. Thanks for reply. I have repaired typos.

This is most probably due to the typos.

Does it work now? After editing the blynk.service you’ll have to reload the unit files with:

~# systemctl daemon-reload

And then:

~# service blynk restart

Check if it’s running with:

~# service blynk status

thank you very much. it works .m