Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to clear a file 1

Status
Not open for further replies.

dcomit

Technical User
Joined
Jun 20, 2001
Messages
115
Location
GB
I'm running a script in a cron job which among other things, clears a file using dd. Problem is I can’t suppress the output from dd and I get an email every time the cron job runs.

Any solutions welcome.

Dave
 
More information is required to be able to give you a specific solution, but here are a few suggestions:

You can force the output of any command (even in crontab) to "disappear" with:
/path/to/some_command > /dev/null 2>&1

To clear a file, try:
cp /dev/null /path/to/some_file
or
mv /path/to/some_file /path/to/some_file_<date/time>
(then when more is written to the file, a new version is created)

I hope that helps.

Mike
 
Mike,

many thanks,

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top