I will test what you guys suggested. Thanks again!
On a side note. Let's say I'm running this script form /home/logs directory and it's also working directory for the script. If I create logic to run:
ls -U | head -10 | xargs rm
if log files exceeds 10 files and I run that command, will it...
So I'm making a shell script that basically gets a file count in a directory and if that count exceeds x count then delete x count of files...
It works great out of current directory but I need it to execute on specified directory defined in script. Currently it looks something like this...
So after some further investigation author did create a clean up job that is supposed to keep these log files count under 1000 but at some point that process ran into a loop that killed the CPU and the VM, so the process was killed and in the mean time these logs ran out of control to the point...
Yea I've tried sudo but still doesn't grant permission.
Linux version:
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"...
Really appreciate your input Jas.
So little background for this. We have a 3rd party program that queries these log files that we use to troubleshoot any issues with device discovery. It's our network automation platform that logs all events and then archives them. 3rd party program does...
I'm having a problem where I have to sort through our logs folder on one of our servers which has about 32mil log files on it. ls -l command by itself does not work, which is what I need to see the date of creation. I'm able to run ls -U | head -50 for example to show 50 files at a time but it...