VPS Host Maintenance Shutdown

From VoIPmonitor.org
Revision as of 19:26, 6 January 2026 by Admin (talk | contribs) (Add guide for VPS host maintenance shutdown procedure)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


This guide explains how to perform a planned graceful shutdown of a VoIPmonitor VPS from the HOST system for hardware maintenance. This is different from stopping the VoIPmonitor service from within the VPS (see Systemd Service Management for that procedure).

ℹ️ Note: This guide assumes VoIPmonitor is running inside an LXC container on a SolusVM-managed hypervisor. If you are stopping the VoIPmonitor service only (not the entire VPS), use systemctl stop voipmonitor inside the VPS instead.

Overview: Service-Level vs. VPS-Level Shutdowns

Scenario What You Shutdown Commands Used Documentation
Stop VoIPmonitor application only VoIPmonitor service inside VPS systemctl stop voipmonitor (from within VPS) Systemd Service Management
Shut down entire VPS for maintenance LXC container from host system lxc-stop, sw vps-detach, sw vps-start (from HOST) This guide

Prerequisites

  • SSH access to the HOST system (not the VPS)
  • Root or sudo access on the HOST
  • SolusVM hypervisor commands (sw) available
  • LXC tools installed on host
  • The VPS container name (e.g., sipMON)

Graceful Shutdown Procedure for Planned Hardware Maintenance

Follow these steps from the HOST system to stop a VoIPmonitor VPS cluster for planned hardware maintenance:

Step 1: Stop the Database Service on the Host

Stop the MySQL/MariaDB service running on the host system before stopping the VPS container.

# Stop MySQL/MariaDB on the HOST
service mysql stop

# Verify it is stopped
ps ax | grep mysqld

💡 Tip: If MySQL is running on a different host (not the same server as the VPS), skip this step and stop MySQL on the correct host.

Step 2: Stop the VPS Container

Stop the LXC container hosting VoIPmonitor using the container name.

# Stop the VPS container
lxc-stop -n sipMON

# Verify it is stopped
lxc-ls -f

Replace sipMON with your actual VPS container name.

Step 3: Detach the VPS (SolusVM)

Detach the VPS from SolusVM using the sw command before proceeding with hardware maintenance.

# Detach the VPS
sw vps-detach -n sipMON

⚠️ Warning: The VPS must be fully stopped before detaching. Do not proceed with vps-detach if lxc-stop returned errors.

Step 4: Perform Hardware Maintenance

At this point, you can safely perform hardware maintenance on the host system (e.g., replacing drives, upgrading RAM, power maintenance).

Step 5: Re-attach and Start the VPS (Post-Maintenance)

After hardware maintenance is complete, start the VPS back up in the correct order:

# Re-attach the VPS to SolusVM
sw vps-attach -n sipMON

# Start the VPS container
sw vps-start -n sipMON

# Verify the VPS is running
lxc-ls -f

ℹ️ Note: VoIPmonitor inside the VPS will start automatically if systemd is configured with systemctl enable voipmonitor. See Systemd Service Management for details.

Verification Steps

After bringing the VPS back online, verify that everything is operational:

# 1. Check VPS status
lxc-ls -f

# 2. Start MySQL on host (if applicable)
service mysql start

# 3. Verify VoIPmonitor is running inside VPS
# SSH into the VPS:
ssh root@<VPS_IP>
systemctl status voipmonitor

# 4. Check for SQL queue backlog in the GUI
# Navigate to Settings -> Sensors -> Status
# Monitor SQLq until it returns to 0

ℹ️ Note: Any buffered SQL queries (qoq files in /var/spool/voipmonitor) will be automatically processed when the sensor starts. This may temporarily increase the SQL queue in the GUI.

Troubleshooting

VPS Will Not Stop

If lxc-stop fails or hangs:

# Force stop (last resort)
lxc-stop -n sipMON -k

# Or kill LXC processes directly
lxc-kill -n sipMON

MySQL Will Not Stop

If MySQL fails to stop:

# Check for active connections
netstat -tunap | grep :3306

# Force stop if necessary (ensuring VoIPmonitor VPS is stopped first)
service mysql stop
pkill mysqld

⚠️ Warning: Always stop VoIPmonitor VPS BEFORE stopping MySQL if they are on separate hosts, or use systemd dependency (see Systemd Service Management).

VPS Does Not Start After Re-attach

If the VPS fails to start after vps-attach:

# Check SolusVM logs
tail -f /var/log/solusvm.log

# Check LXC logs
tail -f /var/log/lxc/sipMON.log

# Manually start with LXC
lxc-start -n sipMON -F

AI Summary for RAG

Summary: This guide documents the host-level procedure for gracefully shutting down a VoIPmonitor VPS for planned hardware maintenance when the application runs inside an LXC container on a SolusVM hypervisor. The workflow from the HOST system includes: (1) stopping MySQL with service mysql stop and verifying with ps ax|grep mysqld, (2) stopping the VPS container using lxc-stop -n <container_name>, (3) detaching from SolusVM with sw vps-detach -n <container_name>, performing hardware maintenance, then (4) re-attaching with sw vps-attach -n <container_name> and starting with sw vps-start -n <container_name>. This procedure differs from service-level shutdown (systemctl stop voipmonitor inside VPS) which is documented separately. Post-start verification includes checking VPS status, starting MySQL on host, and monitoring SQL queue backlog in GUI as buffered qoq files are processed.

Keywords: VPS shutdown, host maintenance, LXC container, SolusVM, lxc-stop, lxc-start, sw vps-detach, sw vps-attach, sw vps-start, hardware maintenance, mysql stop, container management, hypervisor, graceful shutdown

Key Questions:

  • How do I shut down a VoIPmonitor VPS from the host system for hardware maintenance?
  • What is the difference between stopping the VoIPmonitor service and stopping the VPS container?
  • What SolusVM commands are used to stop and start a VPS for maintenance?
  • Should I stop MySQL before stopping the VPS container in a SolusVM environment?
  • How do I verify the VPS is stopped before performing hardware maintenance?
  • What order should I follow when starting the VPS back up after maintenance?
  • How do I detach and re-attach a VPS using SolusVM commands?
  • What should I check after bringing the VPS back online?