Trying to untar then chown, and chmod


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Trying to untar then chown, and chmod
# 1  
Old 12-19-2008
Trying to untar then chown, and chmod

I'm changing (trying to anyway) a script that will need to unrar a file, this file will create a directory with files in it. Then I need to change the owner ship and permission on that directory. Finally, I will rsync the directory to another machine.

This is what I have so far.

#!/bin/bash

###Grab the name of the .trz file and unzip

echo -e "Enter the name of the patch file: \c"
read file
tar -zxf $file
##### This is where I'm stuck, not sure what the next step is.


####Below was the original script that would rsynce the directory if the permissions were already set and the file was already untarred####

echo -e "Please enter the directory of patch (exclude trailing slash) : \c"
read patch
rsync -rpvgo --force $patch user@somemachine.com:/srv/patches
rsync -rpvgo --force $patch user@somemachine.com:/srv/patches
# 2  
Old 12-19-2008
Quote:
Originally Posted by walkerl
I'm changing (trying to anyway) a script that will need to unrar a file, this file will create a directory with files in it. Then I need to change the owner ship and permission on that directory. Finally, I will rsync the directory to another machine.
Hello there!
You say unrar but use tar?
Not that I know how You use this script but maybe You could consider passing the filename as a parameter? Unless You are doing some looping here...

What are You missing? Setting mode on the unpacked files? Do You know what settings You want? Do You know where You have unpacked the files?
If, as an example, You have unpacked them in Your current, previously empty, working directory then I guess
Code:
chmod -R 777 .
chown -R user.user .

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to log all file that has been move,chmod,chown?

Hi All, Seeking for your assistance on how to log that has been chmod,mv,chown,chgrp and how to prevent script running while chmod,mv,chown,chgrp are still running? Ex: a/b/c-folder file1.txt file2.txt file3.txt chmod 777 * chown owner owner group mv what i did was(please see... (6 Replies)
Discussion started by: nikki1200
6 Replies

2. Shell Programming and Scripting

Chmod working in sudo run script but chown isn't

My git user has permission in sudoers to run a wrapper script to move files into my webroot. Everything is working fine except for the chown line. After the script has run, the files ar still root:root instead of apache:apache. Scratching my head...:confused: #!/bin/sh echo echo "****... (4 Replies)
Discussion started by: dheian
4 Replies

3. Shell Programming and Scripting

excluding a directory with chown, chmod

does anyone know how to exclude a directory with chown or chmod? im trying to do something like this chown $username:$username $directory/* chown $username:$username $directory/.* chown $username:$username $directory and find $directory/* -type f -exec... (1 Reply)
Discussion started by: vanessafan99
1 Replies

4. Solaris

chown

Hello My oracledatabase creats some xmlfiles. this files has the owner hugo. now I've a script (how runs als hugo2) and this script will insert this XMLFile into the database. But that doesn't work, because the owner of the files is wrong, and hugo has not the rights to insert this files into... (3 Replies)
Discussion started by: Street
3 Replies

5. UNIX and Linux Applications

What is the difference between chmod in solaris and chmod in Linux?

i think it is the same in both... Iam i right? (1 Reply)
Discussion started by: sumaiya
1 Replies

6. Shell Programming and Scripting

Chown - error

I have a file fin2009_4.txt.gz in the unix ftp server. Owner of the file is: ftpusr. -rw-r--r-- 1 ftpusr sap 0 Feb 19 10:19 fin2009_4.txt.gz When I try to delete this file after copying to my home folder, I am getting the following error. rm: fin2009_4.txt.gz1: override... (4 Replies)
Discussion started by: sid1982
4 Replies

7. Shell Programming and Scripting

cp, chown, untar

hello i want shell script. i have a source.txt /home/user409/public_html/test/ /home/user09876/public_html/xdsss/ /home/user9765/public_html/320xxx/ . . . maybe 1000 lines i want . 1.read a source.txt 2.untar special.tar.gz into these directory in source.txt 3.i want to... (14 Replies)
Discussion started by: topic32428285
14 Replies

8. UNIX for Dummies Questions & Answers

chown

is there a difference in chown on a file or a directory? how do i chown a directory and all the contents? (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

9. UNIX for Advanced & Expert Users

chown issue

I have a strange problem in my Linux box (Suse). Recently I took over this box as admin even though I have no prior admin experience. Following is my issue I had following users under 'root' group initially user1 user2 user3 Since I did not like user ids under root group. I modifed these... (9 Replies)
Discussion started by: praveenkumar_l
9 Replies

10. AIX

chown

hello chown not change ownership before: 205:system ~kuku chown kuku:system ~kuku after no change 205:system ~kuku aix box can someone help me? ariec (2 Replies)
Discussion started by: ariec
2 Replies
Login or Register to Ask a Question