Removal of zip file permanently


 
Thread Tools Search this Thread
Operating Systems Solaris Removal of zip file permanently
# 1  
Old 11-14-2011
Removal of zip file permanently

Hi Everyone,

I see some peculier thing happening on my server. I have one zipped file created long back as a normal user and trying to remove it now. When i tried to remove as that particular user, i was not able to do that. So i logged in as a root user and removed that successfully. But it is re-creating again and again for every 2 or 3 days. Dont no what is wrong and where i need to check for that.Smilie I want to remove it permanently. Please Advice on this.

I am using the following command to remove it.

Code:
# rm -rf /name.tar.gz

# 2  
Old 11-14-2011
have a look at your cron jobs.
Code:
crontab -l

Which user is owner of the file?

Considering the name of the file, I suppose a kind of backup script with buggy file name creation, maybe missing quotes around the filename.
# 3  
Old 11-14-2011
Check what is the last modification time for this file.
You can then schedule a script that will do 'ps -ef' (or /usr/ucb/ps auxww) or ptree $(fuser yourfilename.tar.gz 2>/dev/null | paste -sd"\0" -) that you redirect into a log file at the time the tar and/or the tar and/or gzip process are supposed to run so this may help you to identify the script that generate it.
# 4  
Old 11-16-2011
@Aqualung: There are no cronjobs wrt that particular file.

@ctsgnb: I have deleted that file for now, let me wait until it re-creates; to check the time stamp.

Till then awaiting for comments....
# 5  
Old 11-16-2011
Assuming you are running Solaris 10 or newer, you can use dtrace to monitor what process is creating this file.

This script (eg: tracegz.d) should do it:
Code:
syscall::open:entry
{
     self->path = copyinstr(arg0);
}

syscall::open:return
/self->path == "/name.tar.gz"/
{
     printf("Tracked file open:");
     ustack();
}

run it with

Code:
dtrace -s /path_to/tracegz.d

This User Gave Thanks to jlliagre For This Post:
# 6  
Old 11-22-2011
Hi Jlliagre,

Thanks for your post. I am fresher for unix shell scripting, can you please advice me by explaining any modification required in that script you have posted ? I mean to ask, do i need to edit the following by giving any path.
Code:
self->path

And i believe i suppose to give the path where i copied the script for the following one, please correct me if i am wrong.

Code:
dtrace -s /path_to/tracegz.d


Last edited by Sricharan21; 11-22-2011 at 04:24 AM.. Reason: To Add code tags
# 7  
Old 11-22-2011
Quote:
Originally Posted by Sricharan21
I am fresher for unix shell scripting, can you please advice me by explaining any modification required in that script you have posted ?
Be aware that this isn't a shell script but a dtrace one, i.e. using a programming language name D which is closer to C than the usual shell.
Quote:
I mean to ask, do i need to edit the following by giving any path.
If you want to monitor a different file, you can replace "/name.tar.gz" by something like "/the/file/you/want.txt". The script could also be modified to have that file name passed as an argument.
Quote:
And i believe i suppose to give the path where i copied the script for the following one, please correct me if i am wrong.
Code:
dtrace -s /path_to/tracegz.d

That's it. The -s option expects the dtrace script pathname (or just file name if in the same directory).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can we Zip multiple files created on the same date into one single zip file.?

Hi all i am very new to shell scripting and need some help from you to learn 1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder. 2)Post zipping... (1 Reply)
Discussion started by: b.saipriyanka
1 Replies

2. UNIX for Beginners Questions & Answers

How can we Zip multiple files created on the same date into one single zip file.?

Hi all i am very new to shell scripting and need some help from you to learn 1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder. 2)Post zipping... (2 Replies)
Discussion started by: b.saipriyanka
2 Replies

3. Shell Programming and Scripting

Zip Multiple files to One .zip file in AIX system

Hi I have a requirement in unix shell where I need to zip multiple files on server to one single .zip file. I dont see zip command in AIX and gzip command not doing completely what I want. One I do .zip file, I should be able to unzip in my local Computer. Here is example what I want... (9 Replies)
Discussion started by: RAMA PULI
9 Replies

4. UNIX for Dummies Questions & Answers

Replace 8th and 9th characters in file permanently

Good evening, I have a file and wish to replace the 8th and 9th characters on the first line only no matter what they are with 44 and the file permanantly changed. e.g. file example.txt before change: 123456789123456 hi how are you blah blah file example.txt after change: ... (4 Replies)
Discussion started by: GarciasMuffin
4 Replies

5. UNIX for Advanced & Expert Users

Zip file inside Zip file(s)

I've a zip file called Z00.zip and in that file there are 22 more zip files. Each zip file having .txt files nearly 10,000 files. I am trying to unzip all these .txt files in one command line to unzip each .zip file from Z00.zip file. Would like to know whether possible to unzip all sub-zip files... (1 Reply)
Discussion started by: nvkuriseti
1 Replies

6. UNIX for Dummies Questions & Answers

Zip a file with .zip extension.

Hi, I need to zip a .dat file with .zip extension. I tried using the "zip" command. But shell says. "ksh: zip: not found" Currently I am using gunzip to zip and changing the extension ".gz" to ".zip" as follows. mv $file `echo $file | sed 's/\(.*\.\)gz/\1zip/'` But when I tried... (1 Reply)
Discussion started by: aeroticman
1 Replies

7. AIX

ZIP multiple files and also specify size of zip file

I have to zip many pdf files and the size of zip file must not exceed 200 MB. When size is more than 200 MB then multiple zip files needs to be created. How we can achieve this in UNIX? I have tried ZIP utility but it takes a lot of time when we add individual pdfs by looping through a... (1 Reply)
Discussion started by: tom007
1 Replies

8. Programming

how to delete a file permanently from computer

how to delete a file permanently frm computer? (7 Replies)
Discussion started by: unknown9
7 Replies

9. UNIX for Dummies Questions & Answers

unzip .zip file and list the files included in the .zip archive

Hello, I am trying to return the name of the resulting file from a .zip archive file using unix unzip command. unzip c07212007.cef7081.zip Archive: c07212007.cef7081.zip SecureZIP for z/OS by PKWARE inflating: CEP/CEM7080/PPVBILL/PASS/G0063V00 I used the following command to unzip in... (5 Replies)
Discussion started by: oracledev
5 Replies

10. UNIX for Dummies Questions & Answers

how to alter the old file permanently using sed?

hi , m new to sed and awk. can anyone tell me how to alter the old file permanenetly using sed. e.g. $sed 's/cat/dog/g' old_file the above command will replace all the occrance of cat by dog in the file called old_file and by default will show the output at stdout. so is there anyway of... (2 Replies)
Discussion started by: mxms755
2 Replies
Login or Register to Ask a Question