(20241010) Script desc. available in the message now.
This commit is contained in:
@@ -241,7 +241,8 @@ async def get_data(
|
||||
# Successfully retrieved:
|
||||
return ResponseModel(
|
||||
status_code = StatusCodes.OK,
|
||||
data = cred_json["content"]
|
||||
data = cred_json["content"],
|
||||
message = cred_json["desc"]
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
# A quick command to copy sensitive files from development machine to server without involvement of GitHub:
|
||||
|
||||
# Read the servers from the file into an array:
|
||||
mapfile -t SERVERS < servers.txt
|
||||
|
||||
# Display the numbered list of server options:
|
||||
echo "Please select a server:"
|
||||
for i in "${!SERVERS[@]}"; do
|
||||
echo "$((i + 1)). ${SERVERS[i]}"
|
||||
done
|
||||
|
||||
# Prompt the user for their selection
|
||||
read -rp "Select a server by the number ... : " SELECTION
|
||||
|
||||
# Validate the selection
|
||||
if [[ $SELECTION -gt 0 && $SELECTION -le ${#SERVERS[@]} ]]; then
|
||||
|
||||
# Note down the selection in a variable:
|
||||
SELECTED_SERVER=${SERVERS[$((SELECTION - 1))]}
|
||||
|
||||
# Ask the user which directory he wants to upload and his username on the server:
|
||||
read -rp "Your username on the server ..... : " USER
|
||||
read -rp "Directory to send ............... : " SOURCE
|
||||
|
||||
# Run the rsync command:
|
||||
PROJECT_DIRECTORY=$(basename "$PWD")
|
||||
DESTINATION="$USER@$SELECTED_SERVER://home/$USER/programming/python/$PROJECT_DIRECTORY"
|
||||
echo "Trying to send '$SOURCE' to '$DESTINATION'"
|
||||
rsync -avz --mkpath --progress -e "ssh -p 19991" "$SOURCE" "$DESTINATION"
|
||||
|
||||
# Exit with success (assuming that the actual data sending went well):
|
||||
exit 0
|
||||
|
||||
else
|
||||
|
||||
# In case of a wrong server selection, exit with failure.
|
||||
echo "Invalid selection. Please run the script again."
|
||||
exit 1
|
||||
|
||||
fi
|
||||
@@ -1,7 +1,7 @@
|
||||
# We create a Virtual Environment.
|
||||
# The format is:
|
||||
# python<version> -m venv <virtual_env_name>
|
||||
echo "Making a virtual environment (if needed)"
|
||||
echo "Making a virtual environment (if needed)."
|
||||
python3 -m venv .venv
|
||||
|
||||
# Next we activate the newly created Virtual Environment.
|
||||
|
||||
Reference in New Issue
Block a user