Local server doesn't use server.properties and mail.properties

Hello everybody,

I’ve got the local Blynk server working on a Raspberry Pi and I have also been able to run a project from my smartphone to connect with an arduino. So most of the server seems so work correctly.
But the Blynk server doens’t seem to use my files “mail.properties” and “server.properties” which means for instance that I can’t send tokens by mail.
I have done the following:

  • I have put the files “mail.properties” and “server.properties” in the same folder as my “server.jar” file and changed them according to the instuctions under DOCS.

  • I have put the following line in my “rc.local” raspberry-file
    java -jar /home/pi/server.jar -dataFolder /home/pi/Blynk & -serverConfig /home/pi/server.properties &

I can also login to the Administration panel and when I look at “server.properties” in “Config” I see that it does not have the same settings as my “server.properties” file. So I assume the local server does not use my “mail.properties” and “server.properties” files. I have searched for answers in the community but haven’t found a solution.

Does anyone know what the problem is?

Thanks in advance en thanks to Blynk for the great app!
Bart

Hello.

Should be

java -jar /home/pi/server.jar -dataFolder /home/pi/Blynk -serverConfig /home/pi/server.properties &

Hello Dmitriy,

Thanks for the quick response. I tried that before but the result of that is that the blynk server will not start.

What does the &-sign exactly mean?

Bart

Why? Do you see some error? Do you use latest server version?

Run program in separate thread/background.

Hello Dmitriy,

When I add the following line ro rc.local (under /etc):

java -jar /home/pi/server.jar -dataFolder /home/pi/Blynk & -serverConfig /home/pi/server.properties &

and I check if the server is running (with “ps -aux | grep java”) I get :

oot 541 14.6 5.3 323348 50272 ? Sl 10:49 0:30 java -jar /home/pi/server.jar -dataFolder /home/pi/Blynk
pi 1003 0.0 0.2 4280 1908 pts/0 S+ 10:52 0:00 grep --color=auto java

which seems to say the blynk server is running. I can also log in with the app on the server.

When I add your adapted line to rc.local:

java -jar /home/pi/server.jar -dataFolder /home/pi/Blynk -serverConfig /home/pi/server.properties &

and I check if the server is running (with “ps -aux | grep java”) I get :

pi 948 0.0 0.2 4276 2004 pts/0 S+ 11:03 0:00 grep --color=auto java

which seems to say the blynk server is NOT running. I can also NOT log in with the app on the server.

I am using the lasest version of the server (0.16.2). I must say I adapted “rc.local” under /etc and not “rc.local” under /etc/init.d since the latter didn’t seem to work.

Hope this makes things clearer so that a solution can be found.

Greetings,
Bart

Please try to run this command just from command line and tell me what error do you see.

I get the following:

[1] 1116
pi@raspberrypi:~ $ logs.folder property is empty.

I think [1] 1116 has nothing to do with it so I assume is has something to do with the logs.folder

Hello Dimitrey,

This can be helpful. When this from the commandline:

java -jar /home/pi/server.jar -dataFolder /home/pi/Blynk & -serverConfig /home/pi/server.properties &

I get

bash: -serverConfig: command not found
pi@raspberrypi:~ $
Blynk Server successfully started.
All server output is stored in folder ‘/home/pi/./logs’ file.

So your command is probably correct but isn’t the folder “/home/pi/./logs” incorrect? I have a folder “/home/pi/logs”. But how can I change this so the correct folder is used?

Greetings,
Bart

This command is incorrect. Please do not use it anymore.

Look like in your server.properties file property logs.folder is empty. Please double check.

My logs folder is not empty. You can verify in “printscreen 1.png” and “printscreen 2.png” in the attachment.
In my “server.properties” file there is a line “logs.folder=./logs” as instructed in DOCS. You can see this in “server.png” file in the attachment if you would like to check.

Hopes this helps



Please, remove all and start with

java -jar /home/pi/server.jar -dataFolder /home/pi/Blynk -serverConfig /home/pi/server.properties &

from your command line.

Hi,
Could it be the format of your file?

I deleted the “logs” folder and entered the following in the command line:

java -jar /home/pi/server.jar -dataFolder /home/pi/Blynk -serverConfig /home/pi/server.properties &

I got following result:

pi@raspberrypi:~ $ java -jar /home/pi/server.jar -dataFolder /home/pi/Blynk -serverConfig /home/pi/server.properties &
[1] 917
pi@raspberrypi:~ $ logs.folder property is empty.

So I assume the Blynkserver isn’t working an there is still something wrong with the “logs” folder. A new “logs” folder wasn’t created either.

Hope this helps,
Bart

Ok, I think I know the problem. -serverConfig was added just recently. So it should have all properties specified. As workaround for now you may run server without it and it should work as expected.

Hello Dmitriy,

I assume you mean by this that for the moment you can’t use -serverConfig but it will be updated soon? Does this for the moment also mean you can’t send tokens via email using the local server?

Hopefully this can be resolved soon. As a teacher I would like to use Blynk in the coming schoolyear using a Raspberry Pi as local server so I don’t have to rely on our crappy internetconnection :slight_smile:

Greetings,
Bart

You can, but you need to specify all properties described in doc in that case.

You can, just put mail.properties file to folder with jar file.

Hello Dmitriy,

Now I am not following anymore. I specified all properties in the server.properties file as described in doc but it still doens’t seem to work. But I can get around that by logging in the administration UI.

Sending tokens still doesn’t work. I included “mail.properties” in the same folder as “server.jar” . When I open “mail.properties” in a browerser I get:

mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.host=smtp.gmail.com
mail.smtp.port=587
mail.smtp.username=mertensblynk@gmail.com
mail.smtp.password=XXX

XXX is ofcourse not my password. When I ask my app to send a token I get following message:

Email was not send to your login acc.
Please check network connection.

ofcourse I have network connection since I can login to my local server en also run a project to drive an arduino. If sending emails will work I can start using it with my students.

Any idea what can be wrong?

Bart

Please post here your blynk.log file.

Hello Dmitriy,

Here my blink.log file:

18:51:55.523 INFO - Using data dir ‘/home/pi/Blynk’
18:51:57.995 INFO - Region : local
18:51:58.432 INFO - Initializing mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
18:52:00.471 INFO - Plain tcp/ip hardware server port 8442.
18:52:00.488 WARN - ATTENTION. Certificate /home/pi and key /home/pi paths not valid. Using embedded certs. This is not secure. Please replace it with your own certs.
18:52:04.176 INFO - SSL hardware port 8441.
18:52:04.231 WARN - ATTENTION. Server certificate paths cert : ‘/home/pi’, key : ‘/home/pi’ - not valid. Using embedded server certs and one way ssl. This is not secure. Please replace it with your own certs.
18:52:05.904 INFO - Application server port 8443.
18:52:06.310 INFO - HTTP API port 8080.
18:52:06.381 WARN - ATTENTION. Certificate /home/pi and key /home/pi paths not valid. Using embedded certs. This is not secure. Please replace it with your own certs.
18:52:08.059 INFO - HTTPS API port 9443.
18:52:08.134 WARN - ATTENTION. Certificate /home/pi and key /home/pi paths not valid. Using embedded certs. This is not secure. Please replace it with your own certs.
18:52:10.139 INFO - HTTPS admin UI port 7443.
18:52:10.145 INFO - Web Sockets port 8082.
18:52:10.150 WARN - ATTENTION. Certificate /home/pi and key /home/pi paths not valid. Using embedded certs. This is not secure. Please replace it with your own certs.
18:52:12.027 INFO - Web SSL Sockets port 8081.
19:03:38.546 INFO - mertensblynk@gmail.com app joined.
19:13:17.944 INFO - mertensblynk@gmail.com app joined.
19:16:19.929 INFO - mertensblynk@gmail.com hardware joined.
19:28:47.259 INFO - mertensblynk@gmail.com hardware joined.
19:31:07.871 INFO - mertensblynk@gmail.com app joined.
19:31:23.526 INFO - mertensblynk@gmail.com hardware joined.
19:52:26.452 INFO - mertensblynk@gmail.com app joined.
19:52:47.023 INFO - mertensblynk@gmail.com hardware joined.
19:56:15.501 INFO - mertensblynk@gmail.com hardware joined.
19:57:52.127 INFO - mertensblynk@gmail.com hardware joined.
19:59:27.247 INFO - mertensblynk@gmail.com hardware joined.

I only add the mail.properties (without the server.properties):

mail.smtp.auth=true
mail.smtp.starttls.enable=false
mail.smtp.host=smtp.sina.com.cn
mail.smtp.port=25
mail.smtp.username=juncaofish@sina.com
mail.smtp.password=xxxxxx

And it works well (both for send auth token and send msg with mail widget).