Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I created a bash script to run as a cronjob with Cpanel:

--------------content of cron.sh---------------------

#!/bin/bash
curl http://website.com/1.gif >> /home/myuser/public_html/directory/1.gif

------------ end of content -------------------------

I would expect curl to overwrite any existing files, but what occurs is that every time the cron job is executed the destination file doubles in size!

ex: after 1 cron: 1.gif size 50kb

after 2 cron: 1.gif size 100kb

and so on...

I would like simply to overwrite the target file.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Just change the >> to >. The >> is making it append to the file.

share|improve this answer
    
Thank you! Solved –  Antonio Colella Apr 27 '12 at 20:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.