dcat127

How to sync scripts on multiple computers

5 posts in this topic

I have a script that I want to run on multiple computers, this script will:

  • Download an email of over pop3, and after processing it (which may take a minute) delete it from the server. The script will poll the pop3 server every 1 minute to check for new messages.
  • I want to have scripts running on at least 2 different computers (at different locations) to provide: Redundancy and load balancing.
  • It is important that each email only gets processed once.

My question is, what is the best way for the scripts to check whether the other is currently downloading a message on the mail server?

Is using writing information into an Mysql database on the Webserver a good choice?

Share this post


Link to post
Share on other sites



If both computers are on the same network you could write a lock file to a file share when a computer starts to read mails and delete it when he has finished to do so.
The script then just has to check for the lock file and if it exists wait in a loop until it gets deleted.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Both computers are going to be on a separate network

Share this post


Link to post
Share on other sites

If they can't share a file on a network share then a database will be a good choice.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

My question is, what is the best way for the scripts to check whether the other is currently downloading a message on the mail server?

Is using writing information into an Mysql database on the Webserver a good choice?

The answer is .... How else would it be practical. Go for it.
Now, what if the webserver is down ?
How do you handle synchronizing the other scripts.

I'd let them all "check mail, d/l, remove", the script that has the longer .eml is the correct one and sync based on that.  

Or better, once you have the same .eml by more than one script, then remove the source email, just to be safe for the redundancy.

Edit: Let us know how you ended up doing it.

Edited by argumentum

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now