Search Results

Search: Posts Made By: Froob
1,653
Posted By Don Cragun
OK. First: Please use CODE tags when submitting...
OK. First: Please use CODE tags when submitting code and please use indentation that shows the structure of your code. For example, with code tags and indentation to show grouping, your sample code...
1,989
Posted By Chubler_XL
you would use gzip -S .1.gz...
you would use

gzip -S .1.gz /var/log/mrnet.log

But from the filepath and name you really should setup a logrotate entry as /etc/logrotate.d/mrnet something like this

/var/log/mrnet.log
{...
1,989
Posted By jim mcnamara
What exact command did you use? ex.: zip...
What exact command did you use?
ex.:
zip newzipfilename.zip /var/log/mylog.log
2,578
Posted By Yoda
if [ $(stat --printf="%s" mylogfile.log ) -gt...
if [ $(stat --printf="%s" mylogfile.log ) -gt 5000 ]
then
echo "File size is greater than 5000"
else
echo "File size is lesser than 5000"
fi
2,578
Posted By mjf
find mylogfile.log -size +5K -exec echo 'file...
find mylogfile.log -size +5K -exec echo 'file larger than 5k' \;
2,916
Posted By Yoda
tar is an archiving utility. You can check the...
tar is an archiving utility. You can check the manual pages here (https://www.unix.com/man-page/linux/1/tar/) for further reference.
2,916
Posted By DGPickett
tar is an archiver somewhat like zip, older and...
tar is an archiver somewhat like zip, older and not tied to the archive file so closely, not doing updates, deletions and such that zip does.
2,916
Posted By DGPickett
Usually, zip needs a zip archive file to save to....
Usually, zip needs a zip archive file to save to. For compressed content, zip just copies, so there is no waste. Generally, compressing twice makes a third file bigger than the second.

You can...
2,916
Posted By Yoda
I don't think repeated compression is a good...
I don't think repeated compression is a good idea. It can lead to file corruption.

I suggest to tar the file first and then apply a bzip2 compression on top of that.
tar myfilelog.log.tar...
1,552
Posted By Yoda
If you want to move only the first .gz file based...
If you want to move only the first .gz file based on modification time, then you can use ls command with -t option:
for i in $( ls -t *.gz | tr " " "\n" | head -1 )
do
echo "Moving file: ${i}"...
1,552
Posted By Yoda
What have you tried so far? Where are you stuck?
What have you tried so far? Where are you stuck?
1,552
Posted By Yoda
To move gz files in old-logs directory to...
To move gz files in old-logs directory to new-logs directory one-by-one:-
for in in *.gz
do
echo "Moving file: ${i}"
mv ${i} new-logs/
done
To move gz files in old-logs directory to...
1,021
Posted By Scrutinizer
There is a space that should not be there, but...
There is a space that should not be there, but also you cannot use wild cards in combination with test -e like that... Try:
exists() {
[ -e "$1" ]
}

if exists /var/log/*.gz ; then
echo...
Showing results 1 to 13 of 13

 
All times are GMT -4. The time now is 08:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy