Welcome to Centmin Mod Community
Register Now

Cloning server from snapshot, how to prevent duplicate events?

Discussion in 'System Administration' started by MaximilianKohler, Mar 30, 2024.

  1. MaximilianKohler

    MaximilianKohler Member

    146
    1
    18
    Jun 23, 2023
    Ratings:
    +13
    Local Time:
    2:33 AM
    One of the programs I have running on my server is listmonk email/newsletter manager. I had an email campaign scheduled when I created the snapshot, and when I created a new server from that snapshot it sent the email campaign again (even though the campaign was scheduled for 8am and I created the new server at 1pm).

    I'm struggling to wrap my head around this.

    For the DNS I have an A record for listmonk.site.com | main server IP. listmonk loads at listmonk.site.com. Then for the test server I have test.site.com | test server IP.


    A dummy vhost I created loads at test.site.com.

    I think both instances of listmonk are running simultaneously on listmonk.site.com even though they're technically on different servers & IPs, and thus there's no way for me to view and manage them separately?

    In Cloudflare email section I can see the server emails for the test server are being sent from root@centos7test.localdomain, and are failing due to not passing SPF, but listmonk sends via Amazon SES, so that's why they went through.

    Even if I ran a command to kill all active services (listmonk is running as a service) on the cloned server right after it finishes being created, it would probably still send out some emails before I could get to it, and when the services are restarted they'd start sending out the emails again.

    You COULD cancel all email campaigns before creating the snapshot, but that would be tedious, and now I'm wondering if my forum is also performing duplicate actions.
     
  2. eva2000

    eva2000 Administrator Staff Member

    51,616
    11,933
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,420
    Local Time:
    7:33 PM
    Nginx 1.25.x
    MariaDB 10.x
    Don't use listmonk, but easiest solution is if listmonk allowed turning of mailing out of emails no?

    you can do local DNS override to use same hostname to manage each server's IP instance

    If you want to preview newdomain.com or same.hostname.com that is on more than one server on centminmod server without updating DNS, on Windows PC edit your windows HOSTS file at c:\Windows\System32\Drivers\etc\hosts (see guide at How to Edit the Hosts File in Windows 10 or install Hostman app HostsMan which can manage the file too and allows easy dns flushing when you make changes to the hosts file.

    c:\Windows\System32\Drivers\etc\hosts contents to preview without DNS update
    Code:
    centminmodserver-ip-address newdomain.com
    to disable preview comment it out and flush dns for your system
    Code:
    #centminmodserver-ip-address newdomain.com
    Hostsman app to flush dns and edit the c:\Windows\System32\Drivers\etc\hosts file

    And for MacOS users there's How to edit your Mac's Hosts file and why you would want to.

    Reverse DNS override edits to switch back to the other server's IP address