Results 1 to 18 of 18
-
09-10-2002, 10:28 PM #1Disabled
- Join Date
- Aug 2002
- Posts
- 57
How to find and delete all log files **HELP!!**
Does anyone know how to delete all log files, they are taking up so much diskspace and it would take forever to delete them manually so does anyone know a command I can run through SSH run to delete all log files? Something that would search server wide for *.log and delete them all, anyone know how to do that? I need to do it on a Weppliance 3.1 server if that helps. Any help would be GREATTTTTTTTTTTTTLY appericated, thanks!
-
09-10-2002, 11:20 PM #2Web Hosting Master
- Join Date
- Jun 2001
- Location
- Earth
- Posts
- 1,259
find / -name *.log -print
Should find them all. You'll need to run that as root. I would not suggest automatically deleting them. Some processes might not like you removing their log while they are running.
Frank█ Umbra Hosting
█ cPanel | Softaculous | CloudLinux | R1Soft | Ksplice
█ Web Hosting, Reseller Hosting, VPS, Dedicated Servers, Colocation
█ UmbraHosting.com
-
09-10-2002, 11:51 PM #3Disabled
- Join Date
- Aug 2002
- Posts
- 57
But there is about 2,000 of them so I need something that will delete them all.... Anyone know how I can do this??
-
09-11-2002, 01:50 AM #4Disabled
- Join Date
- Aug 2002
- Posts
- 57
Anyone know....?
-
09-11-2002, 02:04 AM #5Junior Guru
- Join Date
- Sep 2002
- Posts
- 246
You can arrange the logs datewise and can delete the old logs at least.
-
09-11-2002, 02:28 AM #6Disabled
- Join Date
- Aug 2002
- Posts
- 57
How do I do that?
-
09-11-2002, 02:47 AM #7Web Hosting Master
- Join Date
- Jul 2002
- Posts
- 924
http://www.webhostingtalk.com/forumd...?s=&forumid=33
You might want to post a request there... someone would probally do what you want for $10Unlimited Space & Bandwidth
http://localhost/
Providing hosting since 17/99/3003
-
09-11-2002, 03:26 AM #8WHT Addict
- Join Date
- Aug 2002
- Posts
- 122
You should employ a program that automatically rotates your logs so that you will never have to face this problem again. I use newsyslog, but there are others.
http://freshmeat.net/search/?q=newsy...ojects&x=0&y=0
(I don't wanna be rude or anything, but if you don't know how to delete some files you shouldn't manage a UNIX 'puter.)Last edited by krc; 09-11-2002 at 03:32 AM.
-
09-11-2002, 09:52 AM #9Web Hosting Evangelist
- Join Date
- Dec 2001
- Location
- Ponchatoula, LA
- Posts
- 497
You could try this:
find / -name "*.log" -exec cp --reply=yes /dev/null {} \;
That will empty all log files instead of deleting them. Some programs, like apache, will get very cranky if you delete a log file while they are running.
It's probably a better idea to rotate your log files as others have said. You never know when you'll have a problem and really wish you had those log files so that you can see what happened.
RichardEnigma Hosting
"I wasn't speeding, I was qualifying!"
-
09-11-2002, 12:19 PM #10Disabled
- Join Date
- Aug 2002
- Posts
- 57
I got this...
[root@host root]# cd ..
[root@host /]# find /home/virtual/ -name "*.log" -exec cp --reply=yes /dev/null {} \;
cp: unrecognized option `--reply=yes'
Try `cp --help' for more information.
cp: unrecognized option `--reply=yes'
Try `cp --help' for more information.
cp: unrecognized option `--reply=yes'
Try `cp --help' for more information.
cp: unrecognized option `--reply=yes'
Try `cp --help' for more information.
cp: unrecognized option `--reply=yes'
Try `cp --help' for more information.
cp: unrecognized option `--reply=yes'
Try `cp --help' for more information.
Any idea what's wrong..?
-
09-11-2002, 12:33 PM #11Web Hosting Master
- Join Date
- Jun 2001
- Location
- Earth
- Posts
- 1,259
Try "man cp" to get the cp options. I believe you want cp -i not cp --reply=yes
Frank█ Umbra Hosting
█ cPanel | Softaculous | CloudLinux | R1Soft | Ksplice
█ Web Hosting, Reseller Hosting, VPS, Dedicated Servers, Colocation
█ UmbraHosting.com
-
09-11-2002, 02:49 PM #12Newbie
- Join Date
- Jul 2002
- Posts
- 25
hmm
dont delete all the logs
i once delete some log and it crash my control panel
delete just the logs of the sitesHttp.co.il - Web Hosting Solutions
-
09-11-2002, 02:54 PM #13Web Hosting Evangelist
- Join Date
- Dec 2001
- Location
- Ponchatoula, LA
- Posts
- 497
The --reply=yes was so that it wouldn't prompt for the overwrite on each file. It worked on the mandrake box I was on, but it didn't work on the red hat box I just tried. Not sure how to force it to overwrite without prompting.
RichardEnigma Hosting
"I wasn't speeding, I was qualifying!"
-
09-11-2002, 03:30 PM #14Web Hosting Guru
- Join Date
- Apr 2002
- Location
- Canada
- Posts
- 283
find / -name "*.log" -exec cp -f /dev/null {} \;
Jason Mansfield - jmansfie [at] uoguelph.ca
-
09-11-2002, 03:42 PM #15Web Hosting Evangelist
- Join Date
- Dec 2001
- Location
- Ponchatoula, LA
- Posts
- 497
I tried cp -f on a red hat box and it still prompts
RichardEnigma Hosting
"I wasn't speeding, I was qualifying!"
-
09-11-2002, 04:03 PM #16Web Hosting Evangelist
- Join Date
- Dec 2001
- Location
- Ponchatoula, LA
- Posts
- 497
Just remembered red hat does an
alias cp='cp -i'
so, do
unalias cp
then you can use
find / -name "*.log" -exec cp /dev/null {} \;
RichardEnigma Hosting
"I wasn't speeding, I was qualifying!"
-
09-12-2002, 01:03 AM #17Disabled
- Join Date
- May 2001
- Posts
- 1,513
I would
1. cd /
2. rm -r *.log and keep my fingers crossed.
-
09-13-2002, 03:24 PM #18Web Hosting Guru
- Join Date
- Aug 2002
- Location
- Denver, CO
- Posts
- 331
[edit] I did not see Noldar's post above. Thats the fix
Last edited by Rebies; 09-13-2002 at 03:30 PM.