tufanv Expert Licensed User Longtime User Mar 14, 2016 #1 Hello I have a non-ui app to run on my vps. Every 1 hour it gets some info from web and send to my sql database. I am planning to run the app 1 time and make this process every 1 hour with a timer . ( so the app will run forever . Does it make any problem for my server ? For example logs will be very big after some time so maybe i must not log the information inside my app or any other problems like this ?
Hello I have a non-ui app to run on my vps. Every 1 hour it gets some info from web and send to my sql database. I am planning to run the app 1 time and make this process every 1 hour with a timer . ( so the app will run forever . Does it make any problem for my server ? For example logs will be very big after some time so maybe i must not log the information inside my app or any other problems like this ?
Erel B4X founder Staff member Licensed User Longtime User Mar 14, 2016 #2 Make sure to run the app with nohup. There is no problem with running non-ui apps for very long times. The B4i builders which are implemented as B4J servers (non-ui apps) were running for 4 months before the last update (which required restarting them). Upvote 0
Make sure to run the app with nohup. There is no problem with running non-ui apps for very long times. The B4i builders which are implemented as B4J servers (non-ui apps) were running for 4 months before the last update (which required restarting them).
jmon Well-Known Member Licensed User Longtime User Mar 14, 2016 #3 one of my app has a server running non-stop for almost a year now, and no issue so far The problem you may have is with your logs as you mention. If you want to write them to a file, you first need to read the file, then append your line to the text and write the whole file again. That can slow down your app if you have thousands of lines in your log. Upvote 0
one of my app has a server running non-stop for almost a year now, and no issue so far The problem you may have is with your logs as you mention. If you want to write them to a file, you first need to read the file, then append your line to the text and write the whole file again. That can slow down your app if you have thousands of lines in your log.
tufanv Expert Licensed User Longtime User Mar 14, 2016 #4 Erel said: Make sure to run the app with nohup. There is no problem with running non-ui apps for very long times. The B4i builders which are implemented as B4J servers (non-ui apps) were running for 4 months before the last update (which required restarting them). Click to expand... I used Code: Copy java -jar /opt/cenk.jar > output.txt What is the difference with this and nohup ? It is working fine now but i can change it if it is not ok and start with nohup ( don't know what it is but i can find out =) ) Upvote 0
Erel said: Make sure to run the app with nohup. There is no problem with running non-ui apps for very long times. The B4i builders which are implemented as B4J servers (non-ui apps) were running for 4 months before the last update (which required restarting them). Click to expand... I used Code: Copy java -jar /opt/cenk.jar > output.txt What is the difference with this and nohup ? It is working fine now but i can change it if it is not ok and start with nohup ( don't know what it is but i can find out =) )
B billzhan Active Member Licensed User Longtime User Mar 15, 2016 #5 nohup <yourcommandlines> & will keep the app run after (putty) connection is closed. https://www.b4x.com/android/forum/threads/server-run-a-server-on-a-vps.60378/#content Or search nohup : https://www.b4x.com/android/forum/pages/results/?query=nohup&page=1&prefix=0 Note that if your logs grow too fast, it will be possible that your disks become full. Check them regularly. Upvote 0
nohup <yourcommandlines> & will keep the app run after (putty) connection is closed. https://www.b4x.com/android/forum/threads/server-run-a-server-on-a-vps.60378/#content Or search nohup : https://www.b4x.com/android/forum/pages/results/?query=nohup&page=1&prefix=0 Note that if your logs grow too fast, it will be possible that your disks become full. Check them regularly.
Erel B4X founder Staff member Licensed User Longtime User Mar 15, 2016 #6 Note that the issue with the logs growing indefinitely is not a real problem in most cases. When you run the program with nohup the output is redirected to nohup.out which is deleted every time that you start the server. Assuming that your program writes 10000 messages per day. This is about 200kb per day. So after one year of the server running non-stop the log file will be 70mb. This is the same size of a 20 seconds video file. Upvote 0
Note that the issue with the logs growing indefinitely is not a real problem in most cases. When you run the program with nohup the output is redirected to nohup.out which is deleted every time that you start the server. Assuming that your program writes 10000 messages per day. This is about 200kb per day. So after one year of the server running non-stop the log file will be 70mb. This is the same size of a 20 seconds video file.
tufanv Expert Licensed User Longtime User Mar 15, 2016 #7 billzhan said: nohup <yourcommandlines> & will keep the app run after (putty) connection is closed. https://www.b4x.com/android/forum/threads/server-run-a-server-on-a-vps.60378/#content Or search nohup : https://www.b4x.com/android/forum/pages/results/?query=nohup&page=1&prefix=0 Note that if your logs grow too fast, it will be possible that your disks become full. Check them regularly. Click to expand... I did not use nohup but it is still running. I don't know why but thanks for information. I will start with nohup next time. Thanks Erel for your clarification. My app only writes about 1000 lines. So no problems there. Upvote 0
billzhan said: nohup <yourcommandlines> & will keep the app run after (putty) connection is closed. https://www.b4x.com/android/forum/threads/server-run-a-server-on-a-vps.60378/#content Or search nohup : https://www.b4x.com/android/forum/pages/results/?query=nohup&page=1&prefix=0 Note that if your logs grow too fast, it will be possible that your disks become full. Check them regularly. Click to expand... I did not use nohup but it is still running. I don't know why but thanks for information. I will start with nohup next time. Thanks Erel for your clarification. My app only writes about 1000 lines. So no problems there.