convert to daemon process, instead of cron job #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have changed the code, to be run as a daemon process instead of cron job. As it was mentioned in the README file, it can be run every 1 or 5 minutes typically; therefore I have used 60 seconds sleep time between its runs. The second part of the program, which is listening on sockets, is repeated forever (with 60 seconds delay), and the first part of the program which is reading configuration file, is only done one time, initially. If there is some exception in the first part (reading configuration file), the exception is catched, and it does not enter the second part “listening on socket connection” {it gives “Failed to read configuration file” message.}; Therefore, the second part is only repeated when there has been no exception in the first part. This way, unnecessary repeating of the second part (when the first part has exception) has been omitted.