mirror of
https://github.com/elAgala/server-initializer.git
synced 2026-02-14 05:06:18 +00:00
First working setup
This commit is contained in:
33
setup.sh
33
setup.sh
@@ -1,8 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Installing and setting up nginx"
|
||||
./install_nginx.sh
|
||||
echo "Installing and setting up Docker"
|
||||
./install_docker.sh
|
||||
echo "New user creation"
|
||||
./create_user.sh
|
||||
# Check for required arguments
|
||||
if [ $# -ne 3 ]; then
|
||||
echo "Usage: $0 <username> <server_ip> <port>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract arguments
|
||||
username="$1"
|
||||
server_ip="$2"
|
||||
port="$3"
|
||||
|
||||
# Script path
|
||||
script_path="index.sh"
|
||||
|
||||
# Transfer the script to the server
|
||||
scp -P $port "$script_path" "$username@$server_ip:/tmp/" || {
|
||||
echo "Error transferring script"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Execute the script on the server
|
||||
ssh -P $port "$username@$server_ip" "bash /tmp/"$script_path"" || {
|
||||
echo "Error executing script on server"
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "Script execution completed on $username@$server_ip"
|
||||
|
||||
Reference in New Issue
Block a user