Created
January 7, 2025 14:56
-
-
Save SebastiaanKloos/fee472234ee24f1322ac23b6cd163dd5 to your computer and use it in GitHub Desktop.
Move storage for ZDD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
read -p "Enter domain name (e.g. example.com): " domain_name | |
HOME_DIR=$HOME | |
# Check if source exists | |
if [ ! -d "$HOME_DIR/$domain_name/storage" ]; then | |
echo "Error: Source storage directory not found" | |
exit 1 | |
fi | |
# Ensure target directory exists | |
mkdir -p "$HOME_DIR/$domain_name-deploy" | |
# Move storage directory | |
if ! mv "$HOME_DIR/$domain_name/storage" "$HOME_DIR/$domain_name-deploy/"; then | |
echo "Error: Failed to move storage directory" | |
exit 1 | |
fi | |
# Create symlink | |
if ! ln -s "$HOME_DIR/$domain_name-deploy/storage" "$HOME_DIR/$domain_name/storage"; then | |
echo "Error: Failed to create symlink" | |
exit 1 | |
fi | |
echo "Storage directory moved and symlinked successfully for $domain_name" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment