March 8, 201115 yr Hello, I have a website form that allows users to subscribe to a newsletter. I wrote a sample PHP script that uses fopen() to open a log file named /var/log/signup.txt and add the e-mail to the list (and fclose() afterwards). Very simple. This is all on a dedicated server. The system is default installation of CentOS 5.5. Web server is Apache 2, running PHP 5.1.6. It was working fine (I had some 20 e-mails in the list) and this morning I went to /var/log/ and see that signup.txt file is truncated (zero bytes). I suspect this might be to some housekeeping cron job, but don't have a clue where to look. I understand that I lost the data, but how can I prevent this from happening again? Thanks for any ideas.
March 8, 201115 yr I would use a database for that kinda stuff... to check if you have a cron running that would do it just run crontab -e from the user account that would run the cron to show a list of cron commands in use
March 8, 201115 yr Surely the easiest way would be to change the path of the log to say ~/signup.txt which will make it go to your home directory instead (/home/username/signup.txt) That shouldn't be cleaned up by anything
March 30, 201115 yr Author Surely the easiest way would be to change the path of the log to say ~/signup.txt which will make it go to your home directory instead (/home/username/signup.txt) That shouldn't be cleaned up by anything That it a great idea. I changed it as you wrote and have no problems since. Thanks. Milan B. CountdownGames.tv
Create an account or sign in to comment