Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Linux suddenly truncating my files

Featured Replies

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.

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

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

  • 4 weeks later...
  • 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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.