From 5dd8a464728885ecbb6f894aed111372aacd4606 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 2 Apr 2017 14:22:13 -0300 Subject: Check for ssh_support before doing some admin tasks --- kvmx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kvmx b/kvmx index dc74365..cdd0d39 100755 --- a/kvmx +++ b/kvmx @@ -318,12 +318,12 @@ function kvmx_up { #sleep 5 #echo "" + kvmx_hostname + # Somehow it is starting before DBUS and then crashing, so we try to start again echo "Ensure spice-vdagent is running..." echo "sudo /usr/sbin/service spice-vdagent start" | kvmx_ssh - kvmx_hostname - if [ ! -z "$shared_folder" ] && [ ! -z "$shared_folder_mountpoint" ]; then echo "Mounting $shared_folder on $shared_folder_mountpoint on guest..." echo "sudo mkdir -p $shared_folder_mountpoint" | kvmx_ssh @@ -349,16 +349,16 @@ function kvmx_hostname { # Set hosts entry if ! grep -q "^127.0.0.1 $hostname.$domain $hostname$" /etc/hosts; then - echo "127.0.0.1 $hostname.$domain $hostname" | sudo tee -a /etc/hosts > /dev/null + echo "127.0.0.1 $hostname.$domain $hostname" | sudo tee -a /etc/hosts &> /dev/null fi - echo "$hostname.$domain" | sudo tee /etc/hostname > /dev/null - sudo hostname $hostname.$domain + echo "$hostname.$domain" | sudo tee /etc/hostname &> /dev/null + sudo hostname $hostname.$domain 2> /dev/null # Remove old hostname from hosts file if [ "\$OLD_HOST" != "$hostname.$domain" ]; then if grep -q \$OLD_HOST /etc/hosts; then - sudo sed -i -e "/\$OLD_HOST/d" /etc/hosts + sudo sed -i -e "/\$OLD_HOST/d" /etc/hosts 2> /dev/null fi fi ##### END REMOTE SCRIPT ####### -- cgit v1.2.3