cleaning up
Bradley Giesbrecht
brad at pixilla.com
Tue Jan 12 09:12:34 PST 2010
On Jan 12, 2010, at 8:57 AM, Dan Villiom Podlaski Christiansen wrote:
> On 12 Jan 2010, at 02:15, Bradley Giesbrecht wrote:
>
>>
>> On Jan 11, 2010, at 4:30 PM, Jeremy Lavergne wrote:
>>
>>>> Restoring from a backup is a terrible solution. I make nightly
>>>> backups of my databases but loosing a days worth of data will
>>>> make me very unpopular.
>>>> Likewise losing all the emails in an imap mailbox would make me
>>>> equally unpopular. I think for me it's best to just move user
>>>> data outside /opt/local. I already moved it all to a subdir of /
>>>> opt/local/var I should have just moved it outside /opt/local
>>>> altogether and I wouldn't be worried about find $prefix -exec rm
>>>> commands.
>>>
>>> If it's all in $prefix/var, just run a find command for bin, etc,
>>> include, lib, and share.
>>
>> Good idea.
>>
>> I couldn't manage to get find -path '/opt/local/var' -prune to work
>> but ! seems to work.
>>
>> sudo find /opt/local \( ! -path "/opt/local/var/*" -a ! -path "/opt/
>> local/apache2/*" -a ! -path "/opt/local/www/*" \) -name *.mp_*
>>
>> I think these are two other directories that some of the ports may
>> park user files like some of the web frameworks that allow user
>> uploads.
>
> After a bit of tweaking, I'd suggest:
>
> sudo find /opt/local -regex '.*/[^/]\{1,\}\.mp_[[:digit:]]\{9,10\}' -
> print -delete
>
> If you don't have any very old files, or files which were created
> when the clock was reset:
>
> sudo find /opt/local -regex '.*/[^/]\{1,\}\.mp_[[:digit:]]\{10\}' -
> print -delete
>
> Or, if you want to ignore anything in a ‘var’ directory:
>
> sudo find /opt/local \( -not -path '*/var/*' \) -regex '.*/[^/]
> \{1,\}\.mp_[[:digit:]]\{9,10\}' -print -delete
>
> The first one should be quite safe; user files are unlikely to end
> with ‘.mp_’ followed by 9–10 digits ;-)
I agree and this is safer.
How about:
sudo find /opt/local \( -not -path '*/var/*' \) -regex '.*/[^/]\{1,\}
\.mp_[[:digit:]]\{9,10\}\$' -print
Will this limit it further to only files that end with 9,10 digits?
If I leave off the -delete then I can first print the list or redirect
it to a file and use that file to move the files out of the way and
after a time delete them.
On systems with many users real/virtual and different forms methods
for write access db/ftp/http/mail I need this to be as safe as
reasonably possible.
I don't mind a little litter but having that litter in my env path was
annoying.
Thank you everyone for your contributions,
Brad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20100112/8c08e861/attachment-0001.html>
More information about the macports-dev
mailing list