Initial commit: combine nas_tool, nas_webdav, sync-utils
This commit is contained in:
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Sync projects to server2
|
||||
# Usage: ./sync-to-server.sh [project_name]
|
||||
|
||||
SERVER="server2"
|
||||
REMOTE_PATH="/home/$USER/repos"
|
||||
LOCAL_PATH="/Users/jimmyg/repos"
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${YELLOW}Starting sync to $SERVER...${NC}"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
# Sync specific project
|
||||
PROJECT="$1"
|
||||
echo -e "${GREEN}Syncing project: $PROJECT${NC}"
|
||||
rsync -avz --delete \
|
||||
--exclude='.git/' \
|
||||
--exclude='node_modules/' \
|
||||
--exclude='__pycache__/' \
|
||||
--exclude='*.pyc' \
|
||||
--exclude='.DS_Store' \
|
||||
--exclude='*.log' \
|
||||
"$LOCAL_PATH/$PROJECT/" \
|
||||
"$SERVER:$REMOTE_PATH/$PROJECT/"
|
||||
else
|
||||
# Sync all projects
|
||||
echo -e "${GREEN}Syncing all projects${NC}"
|
||||
rsync -avz --delete \
|
||||
--exclude='.git/' \
|
||||
--exclude='node_modules/' \
|
||||
--exclude='__pycache__/' \
|
||||
--exclude='*.pyc' \
|
||||
--exclude='.DS_Store' \
|
||||
--exclude='*.log' \
|
||||
"$LOCAL_PATH/" \
|
||||
"$SERVER:$REMOTE_PATH/"
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Sync completed!${NC}"
|
||||
Reference in New Issue
Block a user