04-10-2009
Script Syntax on untarring file.
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.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
This isn't a question--its a solution! Below is a script that I wrote for my own script file development which does what the title says. Its the closest that you can get to compiling what are otherwise purely interpreted script files. I offer it here simply for the benefit of anyone else writing... (12 Replies)
Discussion started by: fabulous2
12 Replies
2. Solaris
Hi all,
How to untar a file having .tarz extension?
i tried this
tar -xvfz file.tarz
but i'm getting error like
tar: z: unknown function modifier
Usage: tar {c|r|t|u|x}] {file | -I include-file | -C directory file}...
Can anyone help me out in this....
Thanks in advance.... (2 Replies)
Discussion started by: gullapalli
2 Replies
3. Shell Programming and Scripting
Hi All,
I have written a korn script (code pasted below). It is giving the error while debugging "new.sh: syntax error at line 62: `end of file' unexpected".
I have re-written the whole code in VI and explored all help related to this error on this Unix forum and tried it. Somehow, I could... (7 Replies)
Discussion started by: schandrakar1
7 Replies
4. Shell Programming and Scripting
Need help. I cannot find the reason for this error:
here is the script (6 Replies)
Discussion started by: Lenora2009
6 Replies
5. Shell Programming and Scripting
I am fairly new to scripting.
I have a script to untar files as they come in.
I keep scripts in one directory: /Scripts
I get a tar'ed file in /Processing
*CMD*
$tar -xfv /Processing/File.tar
When i run the script the untared files are placed in /Scripts
i did some hunting around and... (2 Replies)
Discussion started by: purplebirky
2 Replies
6. UNIX for Advanced & Expert Users
hi,
I am in a weird situation. I have a parent tarball which contains 2 sub tarballs.
The structure is such :
Parent.tar.gz ---- > child1.tar.gz and child2.tar.gz
I need to get the size of the parent tarball without untaring it
I know that the command is gunzip -c parent.tar.gz | wc -c ... (1 Reply)
Discussion started by: mnanavati
1 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I want to untar all log files from following tarred directory hierarchy
Log_files.tar.gz/subject*.tar.gz/project*/*.log
It means there are subject1.tar.gz to subject9.tar.gz and in those tarred subect directories there are project1 - project5 directories and in those directories there... (2 Replies)
Discussion started by: rv_trojan
2 Replies
8. Shell Programming and Scripting
first of all I thought the argument DONE is necessary for all scripts that have or begin with do statements which I have on my script, However, I still don't completely understand why I am receiving an error I tried adding another done argument statement but didn't do any good.
I appreciate... (3 Replies)
Discussion started by: wolf@=NK
3 Replies
9. UNIX for Dummies Questions & Answers
Hi All,
I need to grep through a .tar file without untarring it. Would you please help me with that ?
The extension to this request is to use the cut command to extract the data from a particular field.
Appreciate your quick look around (8 Replies)
Discussion started by: sanjaydubey2006
8 Replies
10. Shell Programming and Scripting
I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (1 Reply)
Discussion started by: Gurdza32
1 Replies