Redgate Clone

Shutdown a node gracefully

To ensure the cluster remains in a working state after a reboot of a nodes, we recommend running this script before a shutdown.  I

The script can be added to an automated shutdown process so it's run every time. Please note that there are many shutdown/reboot processes available on a linux VM. It's platform dependant. You may also have a custom setup that overrides such a process.  We recommend using a systemd service.

Alternatively, you can call the script from a cron job that executes 5 mins before a scheduled maintenance window.

Please test the shutdown process. 

  1. The script must have execute permissions.
  2. It writes logs to the syslog. On ubuntu look for the first log line in /var/log/syslog, on RHEL logs found in /var/log/messages or use  journalctl.

N.B. Shutdown and reboot are seen as separate processes. They may require two separate installations of the script, depending on how the VM has been setup.

Use a systemd service to execute the shutdown script automatically

This ensures the script is called on reboot or shutdown.

Ensure systemd is running on your vm.

  1. Download the shutdown script and wait scripts into the VM's home directory give them execute permissions with sudo chmod +rx
    1. Download this Shutdown script.
    2. Download this Wait script.
  2. Download the shutdown and wait systemd service files into this folder /etc/systemd/system and give them execute permissions with sudo chmod +rx.
    1. Download this file Systemd shutdown service
    2. Download this file Systemd wait service
    3. Enable the shutdown service: sudo systemctl enable redgate-clone-shutdown.service.
    4. Enable the wait service: sudo systemctl enable redgate-clone-wait.service.
    5. Start the wait service: sudo systemctl start redgate-clone-wait.service.  This service starts the redgate-clone-shutdown service every time the machine reboots.Alternatively you can use a cron job to startup the shutdown service. If you do use a cron jobb, make sure the service is started with sudo.
    6. Reload the systemd deamons: sudo systemctl daemon-reload.

To test the service run: sudo systemctl start redgate-clone-shutdown.service

To see the logs run:  sudo journalctl -e -f --unit redgate-clone-shutdown.service






Didn't find what you were looking for?