I'm not used to variables in Bash, but it could be something like this : > filename_ape_log= "$dir_ape_log/ape_staging.log"
or > filename_ape_log= "$(dir_ape_log)/ape_staging.log" I'll see if I can add your suggestion Pablo, it's not a bad idea. - Louis Le 2012-09-17 à 13:11, Nicolas Guibert <[email protected]> a écrit : > Thanks. I am actually writing the script on my side. And as I have one > production server and one staging one, I am actually struggling with > variables and concatenation... > > Why is this not working? I get dir_ape_log : not found when launching the > script on the first line > > > dir_ape_log = "/ape_staging/log/" > > filename_ape_log= "${dir_ape_log}/ape_staging.log" > > cp $filename_ape_log "$dir_ape_log`date +%Y_%m_%d__%H_%M_%s`__ape_log.txt" > > echo "" > $filename_ape_log > > > > > 2012/9/17 Pablo Tejada <[email protected]> > You should make it a gist and add a path variable for easier adaption. > > Looks good. > > On Sep 17, 2012 12:50 PM, "Louis Charette" <[email protected]> wrote: > Here you go. Be sure to adjust the path of the script and the logs to your > server configuration. > > >> Create a new file: >> nano /etc/init.d/ape/ape-clean-log.sh >> >> Put this code in the script file. Change the log file location to match your >> server configuration. BE CAREFULL, the line of code to delete the old log >> will delete everything in the folder. That's why I put all my logs in a >> "APE" directory. >> #!/bin/bash >> >> #Copy the current log to a new file. Add the current date to the new file >> name >> cp /var/log/ape/ape.log /var/log/ape/ape_$(date +%d%m%y).log >> >> #Empty the content of the main log file >> echo "" > /var/log/ape/ape.log >> >> # Delete the log files. Find all the file created more than 14 days ago and >> delete them >> find /var/log/ape/ -type f -mtime +14 | xargs -r rm >> >> Give permission to the new file >> chmod +x /etc/init.d/ape/ape-clean-log.sh >> >> Edit crontab >> crontab -e >> >> Code for crontab. Adjust the number (0) if you want the script to execute at >> another time than midnight everynight >> 0 0 * * * /etc/init.d/ape/ape-clean-log > /dev/null > > I didn't test overnight, but I know the line to delete the old file works as > I'm using the same code to manage and move old MySQL Backups. > > > - Louis > > Le 2012-09-17 à 08:55, Nicolas Guibert <[email protected]> a écrit : > >> Great. Why not share the few lines of code here? >> >> Thanks for your time and effort Louis. >> >> >> 2012/9/17 Louis Charette <[email protected]> >> I just tried what I suggested, and it does seems to work. Ape still write in >> the original ape.log file and the previous content is store in another file. >> I also added in my crontab something to get rid of the old files (> 14 days). >> >> - Louis >> >> Le 2012-09-17 à 07:29, Nicolas Guibert <[email protected]> a écrit : >> >>> lol >>> >>> >>> 2012/9/17 Louis Charette <[email protected]> >>> No but I should, last time I check the log was pretty big lol. >>> >>> Envoyé de mon iPhone >>> >>> Le 2012-09-17 à 07:16, Nicolas Guibert <[email protected]> a écrit >>> : >>> >>>> Yes that sounds like a good idea Louis. Many thanks. I will try that and >>>> come back here to confirm that it worked. >>>> >>>> Are you using this Louis? >>>> >>>> >>>> >>>> 2012/9/17 Louis Charette <[email protected]> >>>> Duplicate the file ape is using (copy/paste) and empty the main file after >>>> (echo "" > /var/log/ape.log) ? >>>> >>>> Envoyé de mon iPad >>>> >>>> Le 2012-09-17 à 07:03, Nicolas Guibert <[email protected]> a >>>> écrit : >>>> >>>>> Pablo, >>>>> >>>>> I have tried renaming the APE log file manually and seen with my eyes >>>>> that APE was still logging in the renamed file... Not opening a new file >>>>> with the old name. Which means my renaming was useless. >>>>> >>>>> Do you see the problem? >>>>> >>>>> >>>>> >>>>> 2012/9/17 Pablo Tejada <[email protected]> >>>>> Like i said in my other post, you can go back to using the file log >>>>> method and avoid that the file gets bigger with a cron job. For example >>>>> you can add a job that runs every 24 hours that would rename the ape.log >>>>> file to something like YYYY-MM-DD_HHHH.log >>>>> Ex: 2012-09-17_1301.log >>>>> >>>>> On Sep 17, 2012 4:12 AM, "Nicolas Guibert" <[email protected]> >>>>> wrote: >>>>> Hi Pablo, >>>>> >>>>> Many thanks for your reply. >>>>> >>>>> The problem with the standard file logging implementation is that log >>>>> rotation does not work. My understanding is that the file is not closed >>>>> and reopened when rotated. The file that is open by APE changes its name >>>>> from log.txt to log.txt.1 then it becomes log.txt.2, etc. So the file >>>>> keeps getting bigger and bigger. This makes it very difficult to use the >>>>> logs when needed as I only have one huge file and not one per day as I >>>>> would like. >>>>> >>>>> That's why I tried syslog but that does not seem to help much as the >>>>> memory used by APE gets bigger and bigger until obviously APE crashes... >>>>> I would much prefer if I did not need to restart APE every few days. >>>>> >>>>> I am not sure what version I am using, but it is very likely that it is >>>>> the one that I mentionned in earlier posts, the one that was working fine >>>>> with Mysql (1.0.8 maybe or some version with an 8 in any case). I have >>>>> not updated lately for fear the Mysql would stop working. I have seen >>>>> several threads on this issue so am not really keen on spending time >>>>> dealing with Mysql again. >>>>> >>>>> Again many thanks. What do you think of this? Am I missing something? >>>>> >>>>> >>>>> >>>>> 2012/9/14 Pablo Tejada <[email protected]> >>>>> If you want to go back to the standard file logging implementation. You >>>>> can add a proper file rotation with a cron job. BTW which APE server >>>>> build are you using? >>>>> >>>>> On Sep 14, 2012 2:56 AM, "Nicolas" <[email protected]> wrote: >>>>> Hi, >>>>> >>>>> I have recently switched to syslog for my logs. It is great since I now >>>>> have a proper log rotation (which was not possible with the standard file >>>>> logging implementation) >>>>> >>>>> The problem is that I can see my aped process getting bigger and bigger. >>>>> It looks that it is taking the exact same size as the logs. >>>>> >>>>> After one day of running my program, I already have 192m in Virt memory >>>>> and 152 in Res. >>>>> >>>>> Not surprizingly my process crashed yesterday morning after a few days... >>>>> >>>>> Anything that can avoid that problem? It would be a shame to reload aped >>>>> every day for that... >>>>> >>>>> Nicolas. >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "APE Project" group. >>>>> To post to this group, send email to [email protected] >>>>> To unsubscribe from this group, send email to >>>>> [email protected] >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/ape-project?hl=en >>>>> --- >>>>> APE Project (Ajax Push Engine) >>>>> Official website : http://www.ape-project.org/ >>>>> Git Hub : http://github.com/APE-Project/ >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "APE Project" group. >>>>> To post to this group, send email to [email protected] >>>>> To unsubscribe from this group, send email to >>>>> [email protected] >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/ape-project?hl=en >>>>> --- >>>>> APE Project (Ajax Push Engine) >>>>> Official website : http://www.ape-project.org/ >>>>> Git Hub : http://github.com/APE-Project/ >>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "APE Project" group. >>>>> To post to this group, send email to [email protected] >>>>> To unsubscribe from this group, send email to >>>>> [email protected] >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/ape-project?hl=en >>>>> --- >>>>> APE Project (Ajax Push Engine) >>>>> Official website : http://www.ape-project.org/ >>>>> Git Hub : http://github.com/APE-Project/ >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "APE Project" group. >>>>> To post to this group, send email to [email protected] >>>>> To unsubscribe from this group, send email to >>>>> [email protected] >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/ape-project?hl=en >>>>> --- >>>>> APE Project (Ajax Push Engine) >>>>> Official website : http://www.ape-project.org/ >>>>> Git Hub : http://github.com/APE-Project/ >>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "APE Project" group. >>>>> To post to this group, send email to [email protected] >>>>> To unsubscribe from this group, send email to >>>>> [email protected] >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/ape-project?hl=en >>>>> --- >>>>> APE Project (Ajax Push Engine) >>>>> Official website : http://www.ape-project.org/ >>>>> Git Hub : http://github.com/APE-Project/ >>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "APE Project" group. >>>> To post to this group, send email to [email protected] >>>> To unsubscribe from this group, send email to >>>> [email protected] >>>> For more options, visit this group at >>>> http://groups.google.com/group/ape-project?hl=en >>>> --- >>>> APE Project (Ajax Push Engine) >>>> Official website : http://www.ape-project.org/ >>>> Git Hub : http://github.com/APE-Project/ >>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "APE Project" group. >>>> To post to this group, send email to [email protected] >>>> To unsubscribe from this group, send email to >>>> [email protected] >>>> For more options, visit this group at >>>> http://groups.google.com/group/ape-project?hl=en >>>> --- >>>> APE Project (Ajax Push Engine) >>>> Official website : http://www.ape-project.org/ >>>> Git Hub : http://github.com/APE-Project/ >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "APE Project" group. >>> To post to this group, send email to [email protected] >>> To unsubscribe from this group, send email to >>> [email protected] >>> For more options, visit this group at >>> http://groups.google.com/group/ape-project?hl=en >>> --- >>> APE Project (Ajax Push Engine) >>> Official website : http://www.ape-project.org/ >>> Git Hub : http://github.com/APE-Project/ >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "APE Project" group. >>> To post to this group, send email to [email protected] >>> To unsubscribe from this group, send email to >>> [email protected] >>> For more options, visit this group at >>> http://groups.google.com/group/ape-project?hl=en >>> --- >>> APE Project (Ajax Push Engine) >>> Official website : http://www.ape-project.org/ >>> Git Hub : http://github.com/APE-Project/ >> >> >> -- >> You received this message because you are subscribed to the Google >> Groups "APE Project" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/ape-project?hl=en >> --- >> APE Project (Ajax Push Engine) >> Official website : http://www.ape-project.org/ >> Git Hub : http://github.com/APE-Project/ >> >> >> -- >> You received this message because you are subscribed to the Google >> Groups "APE Project" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/ape-project?hl=en >> --- >> APE Project (Ajax Push Engine) >> Official website : http://www.ape-project.org/ >> Git Hub : http://github.com/APE-Project/ > > > -- > You received this message because you are subscribed to the Google > Groups "APE Project" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/ape-project?hl=en > --- > APE Project (Ajax Push Engine) > Official website : http://www.ape-project.org/ > Git Hub : http://github.com/APE-Project/ > > -- > You received this message because you are subscribed to the Google > Groups "APE Project" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/ape-project?hl=en > --- > APE Project (Ajax Push Engine) > Official website : http://www.ape-project.org/ > Git Hub : http://github.com/APE-Project/ > > > -- > You received this message because you are subscribed to the Google > Groups "APE Project" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/ape-project?hl=en > --- > APE Project (Ajax Push Engine) > Official website : http://www.ape-project.org/ > Git Hub : http://github.com/APE-Project/ -- You received this message because you are subscribed to the Google Groups "APE Project" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/ape-project?hl=en --- APE Project (Ajax Push Engine) Official website : http://www.ape-project.org/ Git Hub : http://github.com/APE-Project/
