Trying to write a script to do the following.
scp to all redhat linux host and install a antivirus tarball. Need to know what additional syntax to use to untar the file and execute the install.sh inside the tarball and then remove the tarball on all remote hosts.
Here is what I have so far.
#!/bin/ksh
PATH=/usr/bin:/usr/sbin:/opt/local/bin:/usr/local/bin
PGM=`basename $0`
HOSTS=$1
[[ -z $HOSTS ]] && HOSTS="`grep -v \# /opt/local/etc/hosts|grep -i linux|nawk '{print $1}'`"
echo "$PGM: Installing Sophos AntiVirus Software"
for host in $HOSTS
do
printf "o PROCESSING HOST: %-20s\n" $host
ping $host 1>/dev/null 2>&1;
if (( $? )) ; then
echo "--Cannot contact host $host";
else
scp -q $host:/shares/cfgscripts/install.sophos.tar ${host:/opt/sophos-av $DIR/
esac
fi
fi;
done
Need some assistance on what to insert after scp the tarball to all the host.