remove directory x seconds after script completes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting remove directory x seconds after script completes
# 1  
Old 10-27-2008
remove directory x seconds after script completes

Hi guys,

I am working with a script within a Mac OS X package installer. The package installer will run the bash script once the files have been copied/installed. I have a little trouble with the last line of my script causing the package installer to crash once in a while and I have narrowed it down to the installer looking for the folder that I am deleting.

What I would like to do is to have the last line run a sleep/rm -rf combo and have it disassociate itself from the script. This way the script completes, the installer completes and then x number of seconds later the actual rm command takes place and the package installer isn't any the wiser.

Is this possible?

Thanks,
Rob
# 2  
Old 10-28-2008
Normally in UNIX you would do something like:

Code:
{ sleep 10 ; rm -rf $FILE ; } &

If that doesn't work, try replacing the {} with ().
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

<< Environmental Variables are not set when script completes >>

Hi Team, I have a wrapper script which i have pasted below, it internally calls one python script to generate Environmental in a file called /home/oracle/myenv.sh, when i execute this script via wrapper script, its not reflecting in my current session, still showing old env variables. any... (2 Replies)
Discussion started by: kamauv234
2 Replies

2. Programming

Cant remove directory on bash script

hi all, this is my script and as you can see in the screenshot i attach its not deleting the directory in the source folder #!/bin/bash cd /vol/cha-work/_ARCHIVE/to_be_archived/audio/robert_test temp=/mnt/robert_test/temp dest=/vol/cha-archive/audio echo "is this archive for an... (2 Replies)
Discussion started by: robertkwild
2 Replies

3. UNIX for Dummies Questions & Answers

Script to remove zip files from a directory

Hi Folks, There is a job which generates a .zip files every day at /usr/app/generated directory , now please advise for the script that will delete this zip files permanently.but while deleting it should make sure that it will not delete the last two days recently generated zip files and this... (1 Reply)
Discussion started by: punpun66
1 Replies

4. Shell Programming and Scripting

Script to search for a character in files in a Directory & remove it

Hi All, Am new to both Unix & this Forum - Need some help on a script that I am trying to write: In a Directory i have few text files which might or might not contain some text that I am trying to find. Once that text is found in any of the files, it needs to be removed from the file ... (6 Replies)
Discussion started by: rituparna_gupta
6 Replies

5. Shell Programming and Scripting

shell to script to remove directory

Hello All I want to delete the directory in my tree structure . all the filenames like this dd-mm-yyyy Example 30-01-2011 31-01-2011 01-02-2011 I want to grep the latest last four days created directorey by not using the find command . how do i do that ? (1 Reply)
Discussion started by: kvk_shell
1 Replies

6. Shell Programming and Scripting

Need script to remove millions of tmp files in /html/cache/ directory

Hello, I just saw that on my vps (centOS) my oscommerce with a seo script has created millions of tmp files inside the /html/cache/ directory. I would need to remove all those files (millions), I tried via shell but the vps loads goes to very high and it hangs, is there some way to do a... (7 Replies)
Discussion started by: andymc1
7 Replies

7. Shell Programming and Scripting

An Issue with the script which used to remove a file from the current directory.

Hello forum members, I am writing a script to two tasks. 1: displaying the list of the files in the current directory. 2: removing the specifed file from the list. I have written a sample script ,so can u please verfiy and correct. echo Enter list of files ls *.txt read textfile rm -f... (3 Replies)
Discussion started by: sivaranga001
3 Replies

8. Shell Programming and Scripting

Script That Can navigate to 3 differents directory & remove files under them

Hi I am Trying to Write a script that can goto 4 different directorys on the server & remove the Files older then 30 days ?? /logs logs1 logs2 logs3 Now I need to remove files under logs1 logs2 logs3 which are older then 30 days whose name stat 'sit' , 'mig','bld' . in... (3 Replies)
Discussion started by: Beginner123
3 Replies

9. Shell Programming and Scripting

Remove shell script and its directory

Hi, I have shell script which is located in /opt/Test/test.sh code in test.sh is as follows #!/bin/sh rm -rf /opt/Test exit 0 when I tried to execute the above script from its location, it shows the following error rm: Cannot remove any directory in the path of the... (2 Replies)
Discussion started by: raghu.amilineni
2 Replies

10. Shell Programming and Scripting

Script to remove all empty files within the directory structure?

Hi I need to write a shell script which basically searches for all the empty files within the directory structure, lists them before asking the user to confirm if they would like to delete them. If the user deletes the file then a notice would appear confirming the file is deleted. I've be... (5 Replies)
Discussion started by: cat123
5 Replies
Login or Register to Ask a Question