Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have written a script to detect access.log.1.gz file in my log directory /var/log/squid/
the problem i am facing is that when i run this script the squid service stops. i think the reason for this is that the current file access.log.1 is in ram is being read.
in my log directory i sometimes get access.log.1.gz, acess.log.2.gz and so on, can someone tell me a better way to do detect only the gz files which are rotated and move them to a desired directory without affecting the squid working
thanks a lot the script is given below
#!/bin/bash
cd /var/log/squid
YMD="`date +%d%b%y`"
echo "------------------------------------------------" >> ~/squid_script/log
echo -e "backup of squid logs on $YMD\n" >> ~/squid_script/log
echo "------------------------------------------------" >> ~/squid_script/log
for file in a*.gz
do
echo -e "renamed file $file to $file$YMD " >> ~/squid_script/log
mv $file /media/backup/access/$file$YMD
echo -e "file $file$YMD transfered to /media/backup/access/ \n" >> ~/squid_script/log
done
So does - ~/squid_script/log
Only contain "*gz" files?
If so, I would be guessing, but it is perhaps stopping due to the zipping not being completed at time of transfer and hence it is actually still
connected to squid who then loses connection and dies. The only test that springs to mind would be to test the size of the zipped file and once it has stopped growing
then moving it.
~/squid_script/log it generates a log of the transfer ">>" redirects the output into the file called "log"
the configuration file /etc/logrotate.conf generates the gz file once a week ie on sunday i run the above script at midnight on monday, so i dont think its the problem of compression
after the access.log.1.gz is formed the system automatically creates a new access.log file
i think that during the transfer this file too is read which causes the problem
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.