B4J Question non-ui app run duration

tufanv

Expert
Licensed User
Longtime User
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 ?
 

jmon

Well-Known Member
Licensed User
Longtime User
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

tufanv

Expert
Licensed User
Longtime User

I used
B4X:
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

B4X founder
Staff member
Licensed User
Longtime User
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

tufanv

Expert
Licensed User
Longtime User

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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…