„runupdate.sh“ ändern
This commit is contained in:
parent
7f5e567068
commit
9d2c7542fc
@ -13,7 +13,7 @@ do
|
|||||||
echo "Checking for updates on server: ${SERVER}"
|
echo "Checking for updates on server: ${SERVER}"
|
||||||
|
|
||||||
# Establish SSH connection to remote server and run commands to check for updates
|
# Establish SSH connection to remote server and run commands to check for updates
|
||||||
SSH_RESULT=$(ssh root@${SERVER} "sudo apt-get update > /dev/null && apt list --upgradable")
|
SSH_RESULT=$(ssh username@${SERVER} "sudo apt-get update > /dev/null && apt list --upgradable")
|
||||||
|
|
||||||
# If updates are available, inform the user
|
# If updates are available, inform the user
|
||||||
if [ -n "${SSH_RESULT}" ]; then
|
if [ -n "${SSH_RESULT}" ]; then
|
||||||
@ -37,7 +37,7 @@ if [[ $UPDATE_CONFIRMATION == "Yes" ]]; then
|
|||||||
echo "Updating server: ${SERVER}"
|
echo "Updating server: ${SERVER}"
|
||||||
|
|
||||||
# Establish SSH connection to remote server and run commands to update
|
# Establish SSH connection to remote server and run commands to update
|
||||||
ssh root@${SERVER} "sudo apt-get update > /dev/null && sudo apt-get upgrade -y" > /dev/null 2>&1
|
ssh username@${SERVER} "sudo apt-get update > /dev/null && sudo apt-get upgrade -y" > /dev/null 2>&1
|
||||||
|
|
||||||
# Check the return value of ssh to determine if the update was successful
|
# Check the return value of ssh to determine if the update was successful
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user