rm substitute with blacklist


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers rm substitute with blacklist
# 1  
Old 12-05-2007
rm substitute with blacklist

hi!
first i want to apologize for two things. my English and (possible) posting in the wrong sub forum (i couldn't find one that fits my question)

I am needing a script that can substitute rm.
the idea is that the operator can/must delete some folders and files from time to time, when the free space on some hard drive is running low, but some other files shouldn't be touched, and you know murphy
i can write a script to do that, but i was hoping someone already did
what i can think is a while loop that reads the blacklist file line by line, and if the %1 equals some line, then echo some msg and stop
but is more complex, i need logs, i have to match full path and, basename of the full path against, the first param. i need to be able to detect errors on the input, and avoid "rm -rf /" hells derived from coding errors

to be clear, i don't want you to make this script (if it has to be done, i will do it, and you will read me in the scripting section asking some specific problems), again, i was hoping some one already invented this wheel

About the interpreter/unix flavour it doesnt matter, if you know one that works on bash/ksh/zsh/csh/.* in SunOS/Linux/AIX/SCO/BSD/.* i will be more than grateful Smilie
# 2  
Old 12-05-2007
What you want to do is to run a shell script in place of the rm exectuable.
Your shell script runs the real rm, but prevents certain actions. Is this right?

Ways to do this:
1. create an alias for rm like alias rm="/path/to/mymscript" in /etc/profile
2. or rename /usr/bin/rm to /usr/bin/realrm and then make /user/bin/rm a link to your script
# 3  
Old 12-06-2007
Quote:
Originally Posted by jim mcnamara
What you want to do is to run a shell script in place of the rm exectuable.
Your shell script runs the real rm, but prevents certain actions. Is this right?

Ways to do this:
1. create an alias for rm like alias rm="/path/to/mymscript" in /etc/profile
2. or rename /usr/bin/rm to /usr/bin/realrm and then make /user/bin/rm a link to your script
you got it right, but i was hoping that the someone already wrote that script, thats the point of my post, to find such a script, to avoid having to do it myself :P
 
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Email alert when client in blacklist joins network

I have a textfile with a list of strings I want to monitor in my network. alertlist: hans franz tanzSo it can output for me whenever the a strings it matched: #!/bin/sh while : ; do testfile="/var/media/ftp/alertlist.txt" ] && echo "${testfile##*/} exists." || echo "${testfile##*/}... (9 Replies)
Discussion started by: lowmaster
9 Replies

2. UNIX for Dummies Questions & Answers

Multipath devnode blacklist

hi all, there´s one thing i dont understand ... in the file /etc/multipath.conf, why do we incluide "dm-" ??? a device mapper dm- is not supposed to be a multipath part that will be used after configuring mutipath dm?? devnode_blacklist { devnode... (0 Replies)
Discussion started by: pabloli150
0 Replies
Login or Register to Ask a Question