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

    179
    5
    18
    Jun 23, 2023
    Ratings:
    +23
    Local Time:
    8:22 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

    53,250
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    1:22 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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