Skip to content

Commit

Permalink
Add uninstall script
Browse files Browse the repository at this point in the history
  • Loading branch information
muratugureminoglu committed Jan 3, 2025
1 parent eb1cc72 commit 707d890
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/main/server/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

# Ant Media Server uninstall script

# Check if the script is run as root
if [ "$EUID" -ne 0 ]; then
echo "Please run this script as root or use sudo."
exit 1
fi

read -p "This script will completely remove Ant Media Server all datas. Are you sure? (yes/no): " CONFIRM
if [[ "$CONFIRM" != "yes" ]]; then
echo "Uninstallation canceled."
exit 0
fi


# Define variables
AMS_DIR="/usr/local/antmedia"
SERVICE_FILE="/etc/systemd/system/antmedia.service"
LOG_DIR="/var/log/antmedia"

# Stop Ant Media Server service
echo "Stopping Ant Media Server service..."
systemctl stop antmedia

# Disable Ant Media Server service
echo "Disabling Ant Media Server service..."
systemctl disable antmedia

# Remove Ant Media Server files and directories
if [ -d "$AMS_DIR" ]; then
echo "Removing Ant Media Server directory: $AMS_DIR"
rm -rf "$AMS_DIR"
else
echo "Ant Media Server directory not found: $AMS_DIR"
fi

# Remove systemd service file
if [ -f "$SERVICE_FILE" ]; then
echo "Removing systemd service file: $SERVICE_FILE"
rm -f "$SERVICE_FILE"
else
echo "Systemd service file not found: $SERVICE_FILE"
fi

# Reload systemd
systemctl daemon-reload

# Remove logs
if [ -d "$LOG_DIR" ]; then
echo "Removing log directory: $LOG_DIR"
rm -rf "$LOG_DIR"
else
echo "Log directory not found: $LOG_DIR"
fi

echo "Ant Media Server has been successfully uninstalled."

exit 0

0 comments on commit 707d890

Please sign in to comment.