Sh3ll



Directory :  /scripts2/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Current File : //scripts2/find_if_user_has_myisam_tables.sh
#!/bin/bash

# Prompt for cPanel username
read -p "Enter the cPanel username: " CPANEL_USER

# Define temporary file location
TMP_FILE="/tmp/myisam_tables.txt"

# Query MySQL to find up to 5 MyISAM tables in the user's databases
mysql --skip-column-names -e "SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA LIKE '${CPANEL_USER}_%' AND ENGINE = 'MyISAM' LIMIT 5;" > "$TMP_FILE"

# Check if any results were found
if [ ! -s "$TMP_FILE" ]; then
    echo "No MyISAM tables found for ${CPANEL_USER}."
    rm -f "$TMP_FILE"
    exit 0
fi

# Display results
echo "MyISAM tables found for ${CPANEL_USER} (showing up to 5):"
cat "$TMP_FILE"

# Clean up
rm -f "$TMP_FILE"

Sh3LL